From 59cc9210fc47a5b2af679803c65669e7e501f0ab Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Fri, 28 May 2010 23:15:55 +0000 Subject: [PATCH] c-common.h (GCC_DIAG_STYLE): Define earlier in the file, before including diagnostic-core.h. 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 | 11 +++++++++++ gcc/Makefile.in | 2 +- gcc/c-common.h | 22 +++++++++++++--------- gcc/c-tree.h | 18 +++--------------- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/cp-tree.h | 17 +++++++---------- gcc/cp/pt.c | 2 +- 7 files changed, 44 insertions(+), 36 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be57481..e87c762 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,16 @@ 2010-05-29 Steven Bosscher + * 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 + * 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. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 1fe89bf..83c1487 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -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 \ diff --git a/gcc/c-common.h b/gcc/c-common.h index 3056cae..f0541e9 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -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 */ diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 6d8394a..30b5274 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -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 */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d9164d2..7d69a6e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,13 @@ 2010-05-29 Steven Bosscher + * 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 + * tree.c (c_register_addr_space): Add stub. 2010-05-28 Joseph Myers diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 37a0f1e..15c0042 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9eeba8a..dcb455b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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" -- 2.7.4