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

Rename WT_FSTREAM methods to avoid using C99 reserved names

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT2.9.0, 3.3.8
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michael.cahill Michael Cahill
                Reporter:
                acm Andrew Morrow
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: