[llvm-commits] [llvm] r58048 - in /llvm/trunk: include/llvm/Support/DataTypes.h.in win32/VMCore/VMCore.vcproj win32/clang.sln

Kenneth Boyd zaimoni at zaimoni.com
Fri Oct 24 11:47:28 PDT 2008


Ted Kremenek wrote:
> On Oct 23, 2008, at 4:28 PM, Steve Naroff wrote:
>
>   
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> ======================================================================
>> --- llvm/trunk/include/llvm/Support/DataTypes.h.in (original)
>> +++ llvm/trunk/include/llvm/Support/DataTypes.h.in Thu Oct 23  
>> 18:28:23 2008
>> @@ -37,6 +37,11 @@
>> # error "Must #define __STDC_LIMIT_MACROS before #including Support/ 
>> DataTypes.h"
>> #endif
>>
>> +#if !defined(__STDC_CONSTANT_MACROS)
>> +# error "Must #define __STDC_CONSTANT_MACROS before " \
>> +        "#including Support/DataTypes.h"
>> +#endif
>> +
>>     
>
> Hi Steve,
>
> This breaks building Clang in Xcode (164 errors).  Everywhere that  
> DataTypes.h is included I see the error "Must #define  
> __STDC_CONSTANT_MACROS before #including Support/DataTypes.h".  What  
> was the motivation for these lines?
>   
C99 and the current C0X draft both have a bogus suggestion [C99 footnote 
220 to 7.18.2p1] (prohbited by C++0X 18.3.1p2, do not have C++03 on hand 
to check) that this macro be defined to enable a number of macros in 
stdint.h in C++.  [E.g., the INT64_C macro.]  As this suggestion has no 
observable effect in a C program, it should be removed from C0X.

I'm certain I'm not the first to have this idea, so I would want to 
research whether this has been officially rejected before proposing it.

In my opinion, the correct way to handle this is to test for the 
definition of the INT64_C macro after including stdint.h.  If INT64_C is 
not defined, then you know you have a broken stdint.h and should error 
immediately.

If furthermore __STDC_CONSTANT_MACROS is not defined, then we can 
suggest that could be the problem (it would fix the problem on GCC, 
which has a C99-compliant stdint.h).

Kenneth





More information about the llvm-commits mailing list