[LLVMdev] Linux-x86 Compatability
Chris Lattner
sabre at nondot.org
Fri Sep 13 11:26:01 PDT 2002
> 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/
More information about the llvm-dev
mailing list