[LLVMdev] Linux-x86 Compatability

Casey Carter ccarter at cs.uiuc.edu
Fri Sep 13 11:06:03 PDT 2002


Chris Lattner wrote:

>>>Interesting.  INT64_MAX is supposed to be provided by
>>>include/Support/DataTypes.h.  Do you know of a reliable preprocessor
>>>symbol that can be used to determine whether we're on a linux box, or
>>>      
>>>
>
>  
>
>>Well, there is always __linux__, but that doesn't necessarily imply that
>>we are on a Linux box with stdint.h.s
>>    
>>
>
>Ok, I'll switch to that from the placeholder "LINUX".
>  
>
Inspection of DataTypes.h shows that inttypes.h is included before the 
test for linux / definition of __STDC_LIMIT_MACROS.  This will not work, 
since stdint.h is implemented by including inttypes.h, which was already 
included the first time with __STDC_LIMIT_MACROS not defined.  I think 
the best solution to this problem is to change DataTypes.h to simply:

  #define __STDC_LIMIT_MACROS
  #include <inttypes.h>

Which will work on both Linux and Solaris without requiring platform detection.

-- 
Casey Carter
Casey at Carter.net
ccarter at uiuc.edu
AIM: cartec69






More information about the llvm-dev mailing list