# HG changeset patch # User james # Date 1054227751 0 # Node ID 4d97756f2fbe039e6c27fedb9ed065d7c7b84988 # Parent ac5cd070b85805aa76fe3c7b7c61c200d39304c9 [xemacs-hg @ 2003-05-29 17:02:31 by james] Fix the use of GCC function attributes in ellcc.c diff -r ac5cd070b858 -r 4d97756f2fbe lib-src/ChangeLog --- a/lib-src/ChangeLog Wed May 28 21:52:26 2003 +0000 +++ b/lib-src/ChangeLog Thu May 29 17:02:31 2003 +0000 @@ -1,3 +1,7 @@ +2003-05-29 Jerry James + + * ellcc.c: Rationalize and repair use of GCC function attributes. + 2003-05-10 Steve Youngs * XEmacs 21.5.13 "cauliflower" is released. diff -r ac5cd070b858 -r 4d97756f2fbe lib-src/ellcc.c --- a/lib-src/ellcc.c Wed May 28 21:52:26 2003 +0000 +++ b/lib-src/ellcc.c Thu May 29 17:02:31 2003 +0000 @@ -79,6 +79,27 @@ #include #include /* Generated files must be included using <...> */ +#ifndef ATTRIBUTE_MALLOC +# if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__==2 && __GNUC_MINOR__>=96)) +# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define ATTRIBUTE_MALLOC +# endif /* GCC version >= 2.96 */ +#endif /* ATTRIBUTE_MALLOC */ + +#ifdef __GNUC_ +# define ATTRIBUTE_FATAL __attribute__ ((noreturn, format (printf, 1, 2))) +#else +# define ATTRIBUTE_FATAL +#endif /* __GNUC__ */ + +#if defined(__GNUC__) && (__GNUC__ >= 2 || (__GNUC__==2 && __GNUC_MINOR__>=5)) +# define ATTRIBUTE_CONST __attribute__ ((const)) +#else +# define ATTRIBUTE_CONST +#endif + + #ifndef HAVE_SHLIB int main (int argc, char *argv[]) @@ -142,11 +163,7 @@ enum mode { ELLCC_COMPILE_MODE, ELLCC_LINK_MODE, ELLCC_INIT_MODE }; #ifdef DEBUG -static const char *ellcc_mode_name (enum mode ellcc_mode) -#if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 5 - __attribute__ ((const)) -#endif - ; +static const char *ellcc_mode_name (enum mode ellcc_mode) ATTRIBUTE_CONST; static const char * ellcc_mode_name (enum mode ellcc_mode) @@ -168,30 +185,10 @@ * Function Prototypes */ -static void *xmalloc (size_t size) -#ifdef __GNUC__ - __attribute__ ((malloc)) -#endif - ; - -static void *xrealloc (void *ptr, size_t size) -#ifdef __GNUC__ - __attribute__ ((malloc)) -#endif - ; - -static char *xstrdup (char *) -#ifdef __GNUC__ - __attribute__ ((malloc)) -#endif - ; - -static void fatal (char *, ...) -#ifdef __GNUC__ - __attribute__ ((noreturn, format (printf, 1, 2))) -#endif - ; - +static void *xmalloc (size_t size) ATTRIBUTE_MALLOC; +static void *xrealloc (void *ptr, size_t size) ATTRIBUTE_MALLOC; +static char *xstrdup (char *) ATTRIBUTE_MALLOC; +static void fatal (char *, ...) ATTRIBUTE_FATAL; static char ** add_string (char **, char *); static char ** add_to_argv (char **, const char *); static char ** do_compile_mode (void);