2 Copyright 2006, Bernhard Fischer
4 Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
9 /* Convenience macros to test the version of gcc. */
11 #if defined __GNUC__ && defined __GNUC_MINOR__
12 # define __GNUC_PREREQ(maj, min) \
13 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
15 # define __GNUC_PREREQ(maj, min) 0
18 /* __restrict is known in EGCS 1.2 and above. */
19 #if !__GNUC_PREREQ (2,92)
21 # define __restrict /* Ignore */
25 /* Define macros for some gcc attributes. This permits us to use the
26 macros freely, and know that they will come into play for the
27 version of gcc in which they are supported. */
29 #if !__GNUC_PREREQ (2,7)
30 # ifndef __attribute__
31 # define __attribute__(x)
36 /* Attribute __malloc__ on functions was valid as of gcc 2.96. */
37 #ifndef ATTRIBUTE_MALLOC
38 # if __GNUC_PREREQ (2,96)
39 # define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
41 # define ATTRIBUTE_MALLOC
42 # endif /* GNUC >= 2.96 */
43 #endif /* ATTRIBUTE_MALLOC */
46 #ifndef ATTRIBUTE_UNUSED
47 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
48 #endif /* ATTRIBUTE_UNUSED */
50 #ifndef ATTRIBUTE_NORETURN
51 #define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
52 #endif /* ATTRIBUTE_NORETURN */
54 #ifndef ATTRIBUTE_PACKED
55 #define ATTRIBUTE_PACKED __attribute__ ((__packed__))
56 #endif /* ATTRIBUTE_PACKED */
58 #ifndef ATTRIBUTE_ALIGNED
59 #define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m)))
60 #endif /* ATTRIBUTE_ALIGNED */
62 /* -fwhole-program makes all symbols local. The attribute externally_visible
63 forces a symbol global. */
64 #ifndef ATTRIBUTE_EXTERNALLY_VISIBLE
65 # if __GNUC_PREREQ (4,1)
66 # define ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((__externally_visible__))
68 # define ATTRIBUTE_EXTERNALLY_VISIBLE
69 # endif /* GNUC >= 4.1 */
70 #endif /* ATTRIBUTE_EXTERNALLY_VISIBLE */
72 /* We use __extension__ in some places to suppress -pedantic warnings
73 about GCC extensions. This feature didn't work properly before
75 #if !__GNUC_PREREQ (2,8)
76 # ifndef __extension__
77 # define __extension__
81 /* ---- Endian Detection ------------------------------------ */
88 #define BB_BIG_ENDIAN 1
89 #define BB_LITTLE_ENDIAN 0
90 #elif __BYTE_ORDER == __BIG_ENDIAN
91 #define BB_BIG_ENDIAN 1
92 #define BB_LITTLE_ENDIAN 0
94 #define BB_BIG_ENDIAN 0
95 #define BB_LITTLE_ENDIAN 1
98 /* ---- Networking ------------------------------------------ */
100 #include <arpa/inet.h>
102 #include <netinet/in.h>
105 /* ---- miscellaneous --------------------------------------- */
107 /* THIS SHOULD BE CLEANED OUT OF THE TREE ENTIRELY */
109 #define N_(Text) (Text)
111 #endif /* platform.h */