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
> 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.Ok, how about this:? #ifndef LLVM_SUPPORT_DATATYPES_H #define LLVM_SUPPORT_DATATYPES_H #define __STDC_LIMIT_MACROS 1 #include <inttypes.h> #ifdef __linux__ #include <endian.h> #endif #ifdef __sparc__ #include <sys/types.h> #ifdef _LITTLE_ENDIAN #define LITTLE_ENDIAN 1 #endif #endif #endif /* LLVM_SUPPORT_DATATYPES_H */ -Chris http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/
Chris Lattner wrote:>>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. >> >>I forgot about endianness.>Ok, how about this:? > >#ifndef LLVM_SUPPORT_DATATYPES_H >#define LLVM_SUPPORT_DATATYPES_H > >#define __STDC_LIMIT_MACROS 1 >#include <inttypes.h> > >#ifdef __linux__ >#include <endian.h> >#endif > >#ifdef __sparc__ >#include <sys/types.h> >#ifdef _LITTLE_ENDIAN >#define LITTLE_ENDIAN 1 >#endif >#endif > > >#ifndef LITTLE_ENDIAN #ifndef BIG_ENDIAN #error Ooops. Fix include/llvm/Bytecode/Primitive.h for your endianness. #endif #endif>#endif /* LLVM_SUPPORT_DATATYPES_H */ > >-Chris > >http://llvm.cs.uiuc.edu/ >http://www.nondot.org/~sabre/Projects/ > >-- Casey Carter Casey at Carter.net ccarter at uiuc.edu AIM: cartec69