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

Rename WT_FSTREAM methods to avoid using C99 reserved names

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • WT2.9.0, 3.3.8
    • Affects Version/s: None
    • Component/s: None
    • None

      If _FORTIFY_SOURCE=2 is defined in the compilation environment, the WiredTiger sources fail to compile:

      In file included from src/third_party/wiredtiger/src/async/async_op.c:9:
      In file included from src/third_party/wiredtiger/src/include/wt_internal.h:379:
      src/third_party/wiredtiger/src/include/os_fstream.i:55:14: error: no member named '__printf_chk' in
            'struct __wt_fstream'
              return (fs->printf(session, fs, fmt, ap));
                      ~~  ^
      /usr/include/x86_64-linux-gnu/bits/stdio2.h:108:3: note: expanded from macro 'printf'
        __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
        ^
      In file included from src/third_party/wiredtiger/src/async/async_worker.c:9:
      In file included from src/third_party/wiredtiger/src/include/wt_internal.h:379:
      src/third_party/wiredtiger/src/include/os_fstream.i:55:14: error: no member named '__printf_chk' in
            'struct __wt_fstream'
              return (fs->printf(session, fs, fmt, ap));
                      ~~  ^
      /usr/include/x86_64-linux-gnu/bits/stdio2.h:108:3: note: expanded from macro 'printf'
        __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
        ^
      1 error generated.
      

      This happens because when _FORTIFY_SOURCE is defined on a glibc environment, printf becomes a macro.

      Note that this is legal under the standard, see http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html

      The names of all library types, macros, variables and functions that come from the ISO C standard are reserved unconditionally.

            Assignee:
            michael.cahill@mongodb.com Michael Cahill (Inactive)
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: