[LLVMbugs] [Bug 21472] New: Support/DataTypes.h requires C99 defines even when compiling in C11 mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 3 16:41:27 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21472

            Bug ID: 21472
           Summary: Support/DataTypes.h requires C99 defines even when
                    compiling in C11 mode
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: tilkax at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ echo '#include <llvm/Support/DataTypes.h>' | clang -std=c11 -xc -
In file included from <stdin>:1:
/usr/include/llvm/Support/DataTypes.h:58:3: error: "Must #define
__STDC_LIMIT_MACROS before #including Support/DataTypes.h"
# error "Must #define __STDC_LIMIT_MACROS before #including
Support/DataTypes.h"
  ^
/usr/include/llvm/Support/DataTypes.h:62:3: error: "Must #define
__STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
# error "Must #define __STDC_CONSTANT_MACROS before " \
  ^
2 errors generated.

The explanation in DataTypes.h:
"Note that this header's correct operation depends on __STDC_LIMIT_MACROS being
defined.  We would define it here, but in order to prevent Bad Things happening
when system headers or C++ STL headers include stdint.h before we define it
here, we define it on the g++ command line (in Makefile.rules)."

I don't think this applies when compiling in C11 mode, e.g. when including this
header from third-party code.

Suggested fix: Surround the error message with "#if __STDC_VERSION__ < 201112L"
or something to that effect.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141104/d2699fc2/attachment.html>


More information about the llvm-bugs mailing list