diff options
author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-01-22 22:55:11 +0000 |
---|---|---|
committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-01-22 22:55:11 +0000 |
commit | 992cb48d69edf2d39dd860e116b2c81ef0b57caa (patch) | |
tree | 1c9eba853c728b5d734506e1c66c269d96fe46ea /include/platform.h | |
parent | 109a761214fa3176bf09b23b4b3f2cb7da5a6971 (diff) | |
download | busybox-w32-992cb48d69edf2d39dd860e116b2c81ef0b57caa.tar.gz busybox-w32-992cb48d69edf2d39dd860e116b2c81ef0b57caa.tar.bz2 busybox-w32-992cb48d69edf2d39dd860e116b2c81ef0b57caa.zip |
- add platform.h.
- use shorter boilerplate while at it.
git-svn-id: svn://busybox.net/trunk/busybox@13494 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'include/platform.h')
-rw-r--r-- | include/platform.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/include/platform.h b/include/platform.h new file mode 100644 index 000000000..763292d7a --- /dev/null +++ b/include/platform.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | Copyright 2006, Bernhard Fischer | ||
3 | |||
4 | Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | ||
5 | */ | ||
6 | #ifndef __PLATFORM_H | ||
7 | #define __PLATFORM_H 1 | ||
8 | |||
9 | /* Convenience macros to test the version of gcc. */ | ||
10 | #undef __GNUC_PREREQ | ||
11 | #if defined __GNUC__ && defined __GNUC_MINOR__ | ||
12 | # define __GNUC_PREREQ(maj, min) \ | ||
13 | ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) | ||
14 | #else | ||
15 | # define __GNUC_PREREQ(maj, min) 0 | ||
16 | #endif | ||
17 | |||
18 | /* __restrict is known in EGCS 1.2 and above. */ | ||
19 | #if !__GNUC_PREREQ (2,92) | ||
20 | # ifndef __restrict | ||
21 | # define __restrict /* Ignore */ | ||
22 | # endif | ||
23 | #endif | ||
24 | |||
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. */ | ||
28 | |||
29 | #if !__GNUC_PREREQ (2,7) | ||
30 | # ifndef __attribute__ | ||
31 | # define __attribute__(x) | ||
32 | # endif | ||
33 | #endif | ||
34 | |||
35 | #if 0 | ||
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__)) | ||
40 | # else | ||
41 | # define ATTRIBUTE_MALLOC | ||
42 | # endif /* GNUC >= 2.96 */ | ||
43 | #endif /* ATTRIBUTE_MALLOC */ | ||
44 | #endif | ||
45 | |||
46 | #ifndef ATTRIBUTE_UNUSED | ||
47 | #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) | ||
48 | #endif /* ATTRIBUTE_UNUSED */ | ||
49 | |||
50 | #ifndef ATTRIBUTE_NORETURN | ||
51 | #define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) | ||
52 | #endif /* ATTRIBUTE_NORETURN */ | ||
53 | |||
54 | #ifndef ATTRIBUTE_PACKED | ||
55 | #define ATTRIBUTE_PACKED __attribute__ ((__packed__)) | ||
56 | #endif /* ATTRIBUTE_NORETURN */ | ||
57 | |||
58 | /* -fwhole-program makes all symbols local. The attribute externally_visible | ||
59 | forces a symbol global. */ | ||
60 | #ifndef ATTRIBUTE_EXTERNALLY_VISIBLE | ||
61 | # if __GNUC_PREREQ (4,1) | ||
62 | # define ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((__externally_visible__)) | ||
63 | # else | ||
64 | # define ATTRIBUTE_EXTERNALLY_VISIBLE | ||
65 | # endif /* GNUC >= 4.1 */ | ||
66 | #endif /* ATTRIBUTE_EXTERNALLY_VISIBLE */ | ||
67 | |||
68 | /* We use __extension__ in some places to suppress -pedantic warnings | ||
69 | about GCC extensions. This feature didn't work properly before | ||
70 | gcc 2.8. */ | ||
71 | #if !__GNUC_PREREQ (2,8) | ||
72 | # ifndef __extension__ | ||
73 | # define __extension__ | ||
74 | # endif | ||
75 | #endif | ||
76 | |||
77 | |||
78 | /* include USAGE_APPLET_x helper macros for usage.h. */ | ||
79 | /* | ||
80 | #include "_usage.h" | ||
81 | */ | ||
82 | #endif /* platform.h */ | ||