c-common.h (GCC_DIAG_STYLE): Define earlier in the file, before including diagnostic...
authorSteven Bosscher <steven@gcc.gnu.org>
Fri, 28 May 2010 23:15:55 +0000 (23:15 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Fri, 28 May 2010 23:15:55 +0000 (23:15 +0000)
gcc/ChangeLog:
* c-common.h (GCC_DIAG_STYLE): Define earlier in the file,
before including diagnostic-core.h.
(c_cpp_error): New prototype moved from c-tree.h.
Use ATTRIBUTE_GCC_DIAG instead of ATTRIBUTE_GCC_CDIAG.
* c-tree.h (ATTRIBUTE_GCC_CDIAG): Remove define.
(pedwarn_c90, perwarn_c99): Use ATTRIBUTE_GCC_DIAG instead.
(c_cpp_error): Prototype moved to c-common.h.
* Makefile.in: Update dependency for C_COMMON_H.

cp/ChangeLog:
* cp-tree.h (ATTRIBUTE_GCC_CXXDIAG): Remove.  Require that
this file is included before c-common.h.  Define GCC_DIAG_STYLE
before including diagnostic-core.h and toplev.h.
(pedwarn_cxx98): Use ATTRIBUTE_GCC_DIAG.
* pt.c: Include cp-tree.h before c-common.h.

From-SVN: r160007

gcc/ChangeLog
gcc/Makefile.in
gcc/c-common.h
gcc/c-tree.h
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/pt.c

index be57481b0c350c6f06a425b25500a31c96af09de..e87c7625f67fbb078e9707a4a8fcb07d6bcbece3 100644 (file)
@@ -1,3 +1,14 @@
+2010-05-29  Steven Bosscher  <steven@gcc.gnu.org>
+
+       * c-common.h (GCC_DIAG_STYLE): Define earlier in the file,
+       before including diagnostic-core.h.
+       (c_cpp_error): New prototype moved from c-tree.h.
+       Use ATTRIBUTE_GCC_DIAG instead of ATTRIBUTE_GCC_CDIAG.
+       * c-tree.h (ATTRIBUTE_GCC_CDIAG): Remove define.
+       (pedwarn_c90, perwarn_c99): Use ATTRIBUTE_GCC_DIAG instead.
+       (c_cpp_error): Prototype moved to c-common.h.
+       * Makefile.in: Update dependency for C_COMMON_H.
+
 2010-05-29  Steven Bosscher  <steven@gcc.gnu.org>
 
        * c-common.h: Add FIXME for awkward split of c_register_addr_space.
index 1fe89bf337bf5340e259ccfa0832ef8f7e742ad8..83c1487c48bc79f54c0321440e7f083f362a644d 100644 (file)
@@ -916,7 +916,7 @@ GGC_H = ggc.h gtype-desc.h statistics.h
 TIMEVAR_H = timevar.h timevar.def
 INSN_ATTR_H = insn-attr.h $(INSN_ADDR_H)
 INSN_ADDR_H = $(srcdir)/insn-addr.h vecprim.h
-C_COMMON_H = c-common.h $(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H)
+C_COMMON_H = c-common.h $(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H) $(DIAGNOSTIC_CORE_H)
 C_PRAGMA_H = c-pragma.h $(CPPLIB_H)
 C_TREE_H = c-tree.h $(C_COMMON_H) $(TOPLEV_H) $(DIAGNOSTIC_H)
 SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h \
index 3056cae3aa1e3a4416d1ed26ce97b2a494ec8372..f0541e927211f78ecd3c72a6eea7860ea473abd5 100644 (file)
@@ -26,6 +26,16 @@ along with GCC; see the file COPYING3.  If not see
 #include "cpplib.h"
 #include "ggc.h"
 
+/* In order for the format checking to accept the C frontend
+   diagnostic framework extensions, you must include this file before
+   toplev.h, not after.  The C front end formats are a subset of those
+   for C++, so they are the appropriate set to use in common code;
+   cp-tree.h overrides this for C++.  */
+#ifndef GCC_DIAG_STYLE
+#define GCC_DIAG_STYLE __gcc_cdiag__
+#endif
+#include "diagnostic-core.h"
+
 /* Usage of TREE_LANG_FLAG_?:
    0: TREE_NEGATED_INT (in INTEGER_CST).
       IDENTIFIER_MARKED (used by search routines).
@@ -999,6 +1009,9 @@ extern void init_c_lex (void);
 
 extern void c_cpp_builtins (cpp_reader *);
 extern void c_cpp_builtins_optimize_pragma (cpp_reader *, tree, tree);
+extern bool c_cpp_error (cpp_reader *, int, int, location_t, unsigned int,
+                        const char *, va_list *)
+     ATTRIBUTE_GCC_DIAG(6,0);
 
 /* Positive if an implicit `extern "C"' scope has just been entered;
    negative if such a scope has just been exited.  */
@@ -1175,13 +1188,4 @@ extern bool c_omp_sharing_predetermined (tree);
 extern tree c_omp_remap_decl (tree, bool);
 extern void record_types_used_by_current_var_decl (tree);
 
-/* In order for the format checking to accept the C frontend
-   diagnostic framework extensions, you must include this file before
-   toplev.h, not after.  The C front end formats are a subset of those
-   for C++, so they are the appropriate set to use in common code;
-   cp-tree.h overrides this for C++.  */
-#ifndef GCC_DIAG_STYLE
-#define GCC_DIAG_STYLE __gcc_cdiag__
-#endif
-
 #endif /* ! GCC_C_COMMON_H */
index 6d8394ac067ce6f817cc089645549ef04a31df84..30b5274841ad2bf0b48083145e52d5bb65845266 100644 (file)
@@ -601,20 +601,8 @@ extern bool c_override_global_bindings_to_false;
 extern void c_finish_incomplete_decl (tree);
 extern void c_write_global_declarations (void);
 
-/* In order for the format checking to accept the C frontend
-   diagnostic framework extensions, you must include this file before
-   toplev.h, not after.  */
-#if GCC_VERSION >= 4001
-#define ATTRIBUTE_GCC_CDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m)
-#else
-#define ATTRIBUTE_GCC_CDIAG(m, n) ATTRIBUTE_NONNULL(m)
-#endif
-
-extern void pedwarn_c90 (location_t, int opt, const char *, ...) ATTRIBUTE_GCC_CDIAG(3,4);
-extern void pedwarn_c99 (location_t, int opt, const char *, ...) ATTRIBUTE_GCC_CDIAG(3,4);
-
-extern bool c_cpp_error (cpp_reader *, int, int, location_t, unsigned int,
-                        const char *, va_list *)
-     ATTRIBUTE_GCC_CDIAG(6,0);
+/* In c-errors.c */
+extern void pedwarn_c90 (location_t, int opt, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4);
+extern void pedwarn_c99 (location_t, int opt, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4);
 
 #endif /* ! GCC_C_TREE_H */
index d9164d2e4dd5089df7ee10caebd9e4328abedb89..7d69a6e0f8cb857a5e1c6016fdff48d94d423803 100644 (file)
@@ -1,3 +1,11 @@
+2010-05-29  Steven Bosscher  <steven@gcc.gnu.org>
+
+       * cp-tree.h (ATTRIBUTE_GCC_CXXDIAG): Remove.  Require that
+       this file is included before c-common.h.  Define GCC_DIAG_STYLE
+       before including diagnostic-core.h and toplev.h.
+       (pedwarn_cxx98): Use ATTRIBUTE_GCC_DIAG.
+       * pt.c: Include cp-tree.h before c-common.h.
+
 2010-05-29  Steven Bosscher  <steven@gcc.gnu.org>
 
        * tree.c (c_register_addr_space): Add stub.
index 37a0f1e50ea3762f2a3d05a4feb9227c931398b2..15c0042a1b92cdfd1ba077a1528eb2035dc8fa70 100644 (file)
@@ -27,8 +27,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "hashtab.h"
 #include "vec.h"
-#include "c-common.h"
-#include "name-lookup.h"
 
 /* In order for the format checking to accept the C++ front end
    diagnostic framework extensions, you must include this file before
@@ -36,18 +34,17 @@ along with GCC; see the file COPYING3.  If not see
    in c-common.h.  */
 #undef GCC_DIAG_STYLE
 #define GCC_DIAG_STYLE __gcc_cxxdiag__
-#if GCC_VERSION >= 4001
-#define ATTRIBUTE_GCC_CXXDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
-#else
-#define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
-#endif
-#ifdef GCC_TOPLEV_H
+#if defined(GCC_TOPLEV_H) || defined (GCC_C_COMMON_H)
 #error \
 In order for the format checking to accept the C++ front end diagnostic \
-framework extensions, you must include this file before toplev.h, not after.
+framework extensions, you must include this file before toplev.h and \
+c-common.h, not after.
 #endif
 #include "toplev.h"
 #include "diagnostic.h"
+#include "c-common.h"
+
+#include "name-lookup.h"
 
 /* Usage of TREE_LANG_FLAG_?:
    0: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
@@ -4813,7 +4810,7 @@ extern const char *class_key_or_enum_as_string    (tree);
 extern void print_instantiation_context                (void);
 extern void maybe_warn_variadic_templates       (void);
 extern void maybe_warn_cpp0x                   (cpp0x_warn_str str);
-extern bool pedwarn_cxx98                       (location_t, int, const char *, ...) ATTRIBUTE_GCC_CXXDIAG(3,4);
+extern bool pedwarn_cxx98                       (location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4);
 
 /* in except.c */
 extern void init_exception_processing          (void);
index 9eeba8a141593787b3168f304b73fc3e717a5c60..dcb455b66aa82caac06f3c02391b0ffd2174d347 100644 (file)
@@ -34,8 +34,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "intl.h"
 #include "pointer-set.h"
 #include "flags.h"
-#include "c-common.h"
 #include "cp-tree.h"
+#include "c-common.h"
 #include "cp-objcp-common.h"
 #include "tree-inline.h"
 #include "decl.h"