OSDN Git Service

* Makefile.in (bversion.h, s-bversion): New targets.
authorbje <bje@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 22 May 2009 06:08:04 +0000 (06:08 +0000)
committerbje <bje@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 22 May 2009 06:08:04 +0000 (06:08 +0000)
(TOPLEV_H): Add bversion.h.
* toplev.h: Include "bversion.h".
(ATTRIBUTE_GCC_DIAG): When building with checking disabled, use
the __format__ attribute only if compiling with the same version
of GCC as the sources (the "build version").

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147792 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/Makefile.in
gcc/toplev.h

index c8505cc..2dbe9ef 100644 (file)
@@ -1,5 +1,14 @@
 2009-05-22  Ben Elliston  <bje@au.ibm.com>
 
 2009-05-22  Ben Elliston  <bje@au.ibm.com>
 
+       * Makefile.in (bversion.h, s-bversion): New targets.
+       (TOPLEV_H): Add bversion.h.
+       * toplev.h: Include "bversion.h".
+       (ATTRIBUTE_GCC_DIAG): When building with checking disabled, use
+       the __format__ attribute only if compiling with the same version
+       of GCC as the sources (the "build version").
+
+2009-05-22  Ben Elliston  <bje@au.ibm.com>
+
        * c-format.c (handle_format_attribute): Fix comment typo.
 
 2009-05-21  Steve Ellcey  <sje@cup.hp.com>
        * c-format.c (handle_format_attribute): Fix comment typo.
 
 2009-05-21  Steve Ellcey  <sje@cup.hp.com>
index a09b5ff..63bf744 100644 (file)
@@ -792,7 +792,7 @@ endif
 
 # Shorthand variables for dependency lists.
 EXCEPT_H = except.h sbitmap.h vecprim.h
 
 # Shorthand variables for dependency lists.
 EXCEPT_H = except.h sbitmap.h vecprim.h
-TOPLEV_H = toplev.h input.h
+TOPLEV_H = toplev.h input.h bversion.h
 TARGET_H = $(TM_H) target.h insn-modes.h
 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
 HOOKS_H = hooks.h $(MACHMODE_H)
 TARGET_H = $(TM_H) target.h insn-modes.h
 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
 HOOKS_H = hooks.h $(MACHMODE_H)
@@ -2455,6 +2455,14 @@ targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
    $(MACHMODE_H) $(TARGET_DEF_H) $(TARGET_H) $(GGC_H) gt-targhooks.h \
    $(OPTABS_H) $(RECOG_H) reload.h
 
    $(MACHMODE_H) $(TARGET_DEF_H) $(TARGET_H) $(GGC_H) gt-targhooks.h \
    $(OPTABS_H) $(RECOG_H) reload.h
 
+bversion.h: s-bversion; @true
+s-bversion: BASE-VER
+       echo "#define BUILDING_GCC_MAJOR `echo $(BASEVER_c) | sed -e 's/^\([0-9]*\).*$$/\1/'`" > bversion.h
+       echo "#define BUILDING_GCC_MINOR `echo $(BASEVER_c) | sed -e 's/^[0-9]*\.\([0-9]*\).*$$/\1/'`" >> bversion.h
+       echo "#define BUILDING_GCC_PATCHLEVEL `echo $(BASEVER_c) | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$$/\1/'`" >> bversion.h
+       echo "#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 + BUILDING_GCC_MINOR)" >> bversion.h
+       $(STAMP) s-bversion
+
 toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
    version.h $(RTL_H) $(FUNCTION_H) $(FLAGS_H) xcoffout.h $(INPUT_H) \
    $(INSN_ATTR_H) output.h $(DIAGNOSTIC_H) debug.h insn-config.h intl.h \
 toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
    version.h $(RTL_H) $(FUNCTION_H) $(FLAGS_H) xcoffout.h $(INPUT_H) \
    $(INSN_ATTR_H) output.h $(DIAGNOSTIC_H) debug.h insn-config.h intl.h \
index 08a89ea..e62aa72 100644 (file)
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_TOPLEV_H
 #define GCC_TOPLEV_H
 #include "input.h"
 #ifndef GCC_TOPLEV_H
 #define GCC_TOPLEV_H
 #include "input.h"
+#include "bversion.h"
 
 /* If non-NULL, return one past-the-end of the matching SUBPART of
    the WHOLE string.  */
 
 /* If non-NULL, return one past-the-end of the matching SUBPART of
    the WHOLE string.  */
@@ -49,7 +50,7 @@ extern void _fatal_insn (const char *, const_rtx, const char *, int, const char
 /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
    each language front end can extend them with its own set of format
    specifiers.  We must use custom format checks.  */
 /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
    each language front end can extend them with its own set of format
    specifiers.  We must use custom format checks.  */
-#if GCC_VERSION >= 4001
+#if (ENABLE_CHECKING && GCC_VERSION >= 4001) || GCC_VERSION == BUILDING_GCC_VERSION
 #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
 #else
 #define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)
 #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
 #else
 #define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)