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 be57481..e87c762 100644 (file)
@@ -1,5 +1,16 @@
 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.
        * c-common.c (c_register_addr_space): Remove here.
        * c-decl.c (c_register_addr_space): Re-add here.
index 1fe89bf..83c1487 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 3056cae..f0541e9 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 6d8394a..30b5274 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 d9164d2..7d69a6e 100644 (file)
@@ -1,5 +1,13 @@
 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.
 
 2010-05-28  Joseph Myers  <joseph@codesourcery.com>
index 37a0f1e..15c0042 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 9eeba8a..dcb455b 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"