Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-11788

Coding standard violates C standard with respect to reserved identifiers

    • Type: Icon: Technical Debt Technical Debt
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Engines

      The coding standard utilizes a double underscore {} _as a prefix for its naming convention, for example __wt_evict_file.

      This is in violation of the standard C11 7.1.3:

      All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.

      This is not purely a theoretical standards compliance concern, for example, MSan tooling injects symbols with the prefix __msan (see below).

      Defining these reserved identifiers is labelled as undefined behavior, though pragmatically it seems the most likely outcome is a link time failure.

      Given the age and distribution of the project has not resulted in any known problem, the likelihood that a problem will arise in the future appears to be negligible. Regardless, this violation of the standard should be considered, and the conclusion documented.

      $ cmake -G Ninja .. -DCMAKE_BUILD_TYPE=MSan
      $  objdump -t libwiredtiger.so.11.2.0  | grep __msan
      0000000000000000         *UND*	0000000000000000              __msan_va_arg_overflow_size_tls
      0000000000000000         *UND*	0000000000000000              __msan_memmove
      0000000000000000         *UND*	0000000000000000              __msan_memcpy
      0000000000000000         *UND*	0000000000000000              __msan_set_alloca_origin4
      00000000007da484  w    O .rodata	0000000000000004              __msan_track_origins
      0000000000000000         *UND*	0000000000000000              __msan_retval_origin_tls
      0000000000000000         *UND*	0000000000000000              __msan_chain_origin
      0000000000000000         *UND*	0000000000000000              __msan_init
      0000000000000000         *UND*	0000000000000000              __msan_param_origin_tls
      0000000000000000         *UND*	0000000000000000              __msan_memset
      0000000000000000         *UND*	0000000000000000              __msan_warning_with_origin_noreturn
      0000000000000000         *UND*	0000000000000000              __msan_retval_tls
      0000000000000000         *UND*	0000000000000000              __msan_param_tls
      0000000000000000         *UND*	0000000000000000              __msan_va_arg_tls
      

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            marc.butler@mongodb.com Marc Butler (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: