3 /* FIXME: this is all from ansidecl. better to simply swipe
4 that file from egcs/include and include it from here. */
6 /* Using MACRO(x,y) in cpp #if conditionals does not work with some
7 older preprocessors. Thus we can't define something like this:
9 #define HAVE_GCC_VERSION(MAJOR, MINOR) \
10 (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
12 and then test "#if HAVE_GCC_VERSION(2,7)".
14 So instead we use the macro below and test it against specific values. */
16 /* This macro simplifies testing whether we are using gcc, and if it
17 is of a particular minimum version. (Both major & minor numbers are
18 significant.) This macro will evaluate to 0 if we are not using
21 # define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
22 #endif /* GCC_VERSION */
24 /* Define macros for some gcc attributes. This permits us to use the
25 macros freely, and know that they will come into play for the
26 version of gcc in which they are supported. */
28 #if (GCC_VERSION < 2007)
29 # define __attribute__(x)
32 /* Attribute __malloc__ on functions was valid as of gcc 2.96. */
33 #ifndef ATTRIBUTE_MALLOC
34 # if (GCC_VERSION >= 2096)
35 # define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
37 # define ATTRIBUTE_MALLOC
38 # endif /* GNUC >= 2.96 */
39 #endif /* ATTRIBUTE_MALLOC */
41 /* Attributes on labels were valid as of gcc 2.93. */
42 #ifndef ATTRIBUTE_UNUSED_LABEL
43 # if (GCC_VERSION >= 2093)
44 # define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
46 # define ATTRIBUTE_UNUSED_LABEL
47 # endif /* GNUC >= 2.93 */
48 #endif /* ATTRIBUTE_UNUSED_LABEL */
50 #ifndef ATTRIBUTE_UNUSED
51 # define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
52 #endif /* ATTRIBUTE_UNUSED */
54 #ifndef ATTRIBUTE_NORETURN
55 # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
56 #endif /* ATTRIBUTE_NORETURN */
58 #ifndef ATTRIBUTE_PRINTF
59 # define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
60 # define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
61 # define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
62 # define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
63 # define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
64 # define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
65 #endif /* ATTRIBUTE_PRINTF */
67 extern void fatal (int errnum
, const char *format
, ...)
68 ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_2
;