From: Kaveh R. Ghazi Date: Sun, 10 Oct 1999 13:02:41 +0000 (+0000) Subject: ansidecl.h (HAVE_GCC_VERSION): New macro. X-Git-Tag: prereleases/libstdc++-2.92~10137 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b30bce6b52996616cb627a68222fbf5d8be9d4b9;p=thirdparty%2Fgcc.git ansidecl.h (HAVE_GCC_VERSION): New macro. include: * ansidecl.h (HAVE_GCC_VERSION): New macro. Use instead of explicitly testing __GNUC__ and __GNUC_MINOR__. (ATTRIBUTE_PRINTF): Use `__format__', not `format'. gcc: * cppinit.c: Use HAVE_GCC_VERSION instead of explicitly testing __GNUC__ and __GNUC_MINOR__. * gansidecl.h: Likewise. * rtl.c: Likewise. * rtl.h: Likewise. * toplev.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * varray.c: Likewise. * varray.h: Likewise. cp: * cp-tree.h: Use HAVE_GCC_VERSION instead of explicitly testing __GNUC__ and __GNUC_MINOR__. f: * proj.h: Use HAVE_GCC_VERSION instead of explicitly testing __GNUC__ and __GNUC_MINOR__. Don't define BUILT_WITH_270. Define macro UNUSED in terms of ATTRIBUTE_UNUSED. From-SVN: r29890 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3686ea0b102b..c0afb4e7fbe8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +Sun Oct 10 08:40:00 1999 Kaveh R. Ghazi + + * cppinit.c: Use HAVE_GCC_VERSION instead of explicitly testing + __GNUC__ and __GNUC_MINOR__. + + * gansidecl.h: Likewise. + + * rtl.c: Likewise. + + * rtl.h: Likewise. + + * toplev.h: Likewise. + + * tree.c: Likewise. + + * tree.h: Likewise. + + * varray.c: Likewise. + + * varray.h: Likewise. + Sun Oct 10 13:28:48 1999 Bernd Schmidt * loop.c (find_and_verify_loops): When looking for a BARRIER, don't diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a4ab8c59f17e..cd6807acc2ad 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1999-10-10 Kaveh R. Ghazi + + * cp-tree.h: Use HAVE_GCC_VERSION instead of explicitly testing + __GNUC__ and __GNUC_MINOR__. + 1999-10-09 Mark Mitchell * cp-tree.h (make_rtl_for_local_static): New function. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index ea8e495f1ae0..82ed8824a8bc 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -123,7 +123,7 @@ Boston, MA 02111-1307, USA. */ /* Language-specific tree checkers. */ -#if defined ENABLE_CHECKING && (__GNUC__ > 2 || __GNUC_MINOR__ > 6) +#if defined ENABLE_CHECKING && HAVE_GCC_VERSION(2,7) #define VAR_OR_FUNCTION_DECL_CHECK(NODE) \ ({ const tree __t = NODE; \ diff --git a/gcc/cppinit.c b/gcc/cppinit.c index a30344d86a59..ec59a76995e1 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -212,8 +212,7 @@ enum { QUOTE = 0, BRACKET, SYSTEM, AFTER }; /* If gcc is in use (stage2/stage3) we can make these tables initialized data. */ -#if defined __GNUC__ && (__GNUC__ > 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)) +#if HAVE_GCC_VERSION(2,7) /* Table to tell if a character is legal as the second or later character of a C identifier. */ U_CHAR is_idchar[256] = diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 425f6a02cf27..5f48879ffb1d 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,9 @@ +Sun Oct 10 08:40:18 1999 Kaveh R. Ghazi + + * proj.h: Use HAVE_GCC_VERSION instead of explicitly testing + __GNUC__ and __GNUC_MINOR__. Don't define BUILT_WITH_270. Define + macro UNUSED in terms of ATTRIBUTE_UNUSED. + Fri Sep 24 10:48:10 1999 Bernd Schmidt * com.c (duplicate_decls): Use DECL_BUILT_IN_CLASS rather than diff --git a/gcc/f/proj.h b/gcc/f/proj.h index 47fc2f94ab73..96bb44af27c9 100644 --- a/gcc/f/proj.h +++ b/gcc/f/proj.h @@ -31,18 +31,10 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif #include "system.j" -#if !defined (__GNUC__) || (__GNUC__ < 2) +#if ! HAVE_GCC_VERSION(2,0) #error "You have to use gcc 2.x to build g77 (might be fixed in g77-0.6)." #endif -#ifndef BUILT_WITH_270 -#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -#define BUILT_WITH_270 1 -#else -#define BUILT_WITH_270 0 -#endif -#endif /* !defined (BUILT_WITH_270) */ - /* Include files everyone gets. is needed for assert(). is needed for offsetof, but technically also NULL, size_t, ptrdiff_t, and so on. */ @@ -69,11 +61,7 @@ typedef enum #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) #ifndef UNUSED /* Compile with -DUNUSED= if cc doesn't support this. */ -#if BUILT_WITH_270 -#define UNUSED __attribute__ ((unused)) -#else /* !BUILT_WITH_270 */ -#define UNUSED -#endif /* !BUILT_WITH_270 */ +#define UNUSED ATTRIBUTE_UNUSED #endif /* !defined (UNUSED) */ #ifndef dmpout diff --git a/gcc/gansidecl.h b/gcc/gansidecl.h index f867cda0426f..17a7c919b632 100644 --- a/gcc/gansidecl.h +++ b/gcc/gansidecl.h @@ -41,7 +41,7 @@ Boston, MA 02111-1307, USA. */ need to do this very early; i.e. before any systems header files or gcc header files in case they use these keywords. Otherwise conflicts might occur. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +#if HAVE_GCC_VERSION(2,7) # undef const # undef inline # define inline __inline__ /* Modern gcc can use `__inline__' freely. */ diff --git a/gcc/rtl.c b/gcc/rtl.c index 495512efceae..b4cee5878410 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -981,7 +981,7 @@ read_rtx (infile) return return_rtx; } -#if defined ENABLE_CHECKING && (__GNUC__ > 2 || __GNUC_MINOR__ > 6) +#if defined ENABLE_CHECKING && HAVE_GCC_VERSION(2,7) void rtl_check_failed_bounds (r, n, file, line, func) rtx r; diff --git a/gcc/rtl.h b/gcc/rtl.h index 8bd4871bf907..46a79a4b15eb 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -230,7 +230,7 @@ typedef struct rtvec_def{ /* General accessor macros for accessing the fields of an rtx. */ -#if defined ENABLE_CHECKING && (__GNUC__ > 2 || __GNUC_MINOR__ > 6) +#if defined ENABLE_CHECKING && HAVE_GCC_VERSION(2,7) /* The bit with a star outside the statement expr and an & inside is so that N can be evaluated only once. */ #define RTL_CHECK1(RTX, N, C1) \ @@ -1673,7 +1673,7 @@ extern void rtx_free PROTO ((rtx)); extern void fancy_abort PROTO((const char *, int, const char *)) ATTRIBUTE_NORETURN; -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +#if ! HAVE_GCC_VERSION(2,7) #define abort() fancy_abort (__FILE__, __LINE__, 0) #else #define abort() fancy_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) diff --git a/gcc/toplev.h b/gcc/toplev.h index 508cd9d15eca..f0d1b6136480 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -51,7 +51,7 @@ extern void _fatal_insn PROTO ((const char *, const char *)) ATTRIBUTE_NORETURN; -#if defined __GNUC__ && (__GNUC__ > 2 || __GNUC_MINOR__ > 6) +#if HAVE_GCC_VERSION(2,7) #define fatal_insn(msgid, insn) \ _fatal_insn (msgid, insn, __FILE__, __LINE__, __PRETTY_FUNCTION__) #define fatal_insn_not_found(insn) \ diff --git a/gcc/tree.c b/gcc/tree.c index 3538022038d0..1fe428a72b7f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5140,7 +5140,7 @@ get_set_constructor_bytes (init, buffer, wd_size) return non_const_bits; } -#if defined ENABLE_CHECKING && (__GNUC__ > 2 || __GNUC_MINOR__ > 6) +#if defined ENABLE_CHECKING && HAVE_GCC_VERSION(2,7) /* Complain that the tree code of NODE does not match the expected CODE. FILE, LINE, and FUNCTION are of the caller. */ void diff --git a/gcc/tree.h b/gcc/tree.h index d5a4b458a3cb..f66a5ec74977 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -323,7 +323,7 @@ struct tree_common /* When checking is enabled, errors will be generated if a tree node is accessed incorrectly. The macros abort with a fatal error. */ -#if defined ENABLE_CHECKING && (__GNUC__ > 2 || __GNUC_MINOR__ > 6) +#if defined ENABLE_CHECKING && HAVE_GCC_VERSION(2,7) #define TREE_CHECK(t, code) \ ({ const tree __t = t; \ @@ -2519,7 +2519,7 @@ extern void dwarf2out_end_epilogue PROTO((void)); extern void fancy_abort PROTO((const char *, int, const char *)) ATTRIBUTE_NORETURN; -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +#if ! HAVE_GCC_VERSION(2,7) #define abort() fancy_abort (__FILE__, __LINE__, 0) #else #define abort() fancy_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) diff --git a/gcc/varray.c b/gcc/varray.c index 8d65b181ec87..95752c4e5310 100644 --- a/gcc/varray.c +++ b/gcc/varray.c @@ -71,7 +71,7 @@ varray_grow (va, n) /* Check the bounds of a varray access. */ -#if defined ENABLE_CHECKING && (__GNUC__ > 2 || __GNUC_MINOR__ > 6) +#if defined ENABLE_CHECKING && HAVE_GCC_VERSION(2,7) extern void error PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1; diff --git a/gcc/varray.h b/gcc/varray.h index 53b164ba4664..b826b63d6c66 100644 --- a/gcc/varray.h +++ b/gcc/varray.h @@ -163,7 +163,7 @@ extern varray_type varray_grow PROTO((varray_type, size_t)); #define VARRAY_SIZE(VA) ((VA)->num_elements) /* Check for VARRAY_xxx macros being in bound. */ -#if defined ENABLE_CHECKING && (__GNUC__ > 2 || (__GNUC__ == 2 &&__GNUC_MINOR__ > 6)) +#if defined ENABLE_CHECKING && HAVE_GCC_VERSION(2,7) extern void varray_check_failed PROTO ((varray_type, size_t, const char *, int, const char *)) ATTRIBUTE_NORETURN; diff --git a/include/ChangeLog b/include/ChangeLog index c9e21cea5e2b..48f548ed62c9 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,10 @@ +1999-10-10 Kaveh R. Ghazi + + * ansidecl.h (HAVE_GCC_VERSION): New macro. Use it instead of + explicitly testing __GNUC__ and __GNUC_MINOR__. + + (ATTRIBUTE_PRINTF): Use `__format__', not `format'. + 1999-09-25 Kaveh R. Ghazi * libiberty.h (make_temp_file): Add a prototype. diff --git a/include/ansidecl.h b/include/ansidecl.h index 989dd6778dda..8fe3893767fe 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -160,16 +160,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #endif /* ANSI C. */ +/* This macro will return true if we are using gcc, and it is of a + particular minimum version (both major & minor numbers are checked.) */ +#ifndef HAVE_GCC_VERSION +#define HAVE_GCC_VERSION(MAJOR, MINOR) \ + (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR))) +#endif /* ! HAVE_GCC_VERSION */ + /* Define macros for some gcc attributes. This permits us to use the macros freely, and know that they will come into play for the version of gcc in which they are supported. */ -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +#if ! HAVE_GCC_VERSION(2,7) # define __attribute__(x) #endif #ifndef ATTRIBUTE_UNUSED_LABEL -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 93) +# if ! HAVE_GCC_VERSION(2,93) # define ATTRIBUTE_UNUSED_LABEL # else # define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED @@ -185,7 +192,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #endif /* ATTRIBUTE_NORETURN */ #ifndef ATTRIBUTE_PRINTF -#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((format (__printf__, m, n))) +#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) #define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) #define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) #define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)