aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2003-07-04 01:55:50 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2003-07-04 01:55:50 +0000
commit5f1989e65d23624efdbf26bde56f375e3caa6a22 (patch)
treed40d3df53a09947e306cecdd4c52164ae5ff60fc /gcc
parent54c378f0438b6a1d718ef626389fff2ca91a0f9f (diff)
downloadgcc-5f1989e65d23624efdbf26bde56f375e3caa6a22.zip
gcc-5f1989e65d23624efdbf26bde56f375e3caa6a22.tar.gz
gcc-5f1989e65d23624efdbf26bde56f375e3caa6a22.tar.bz2
c-aux-info.c: Include toplev.h after c-tree.h.
gcc: * c-aux-info.c: Include toplev.h after c-tree.h. * c-common.c: Likewise. (GCC_DIAG_STYLE): Undef. * c-semantics.c (GCC_DIAG_STYLE): Define. * c-tree.h (GCC_DIAG_STYLE): Likewise. * diagnostic.h (inform): Move prototype to toplev.h. * jump.c: Include diagnostic.h before toplev.h. * toplev.h (GCC_DIAG_STYLE, ATTRIBUTE_GCC_DIAG): Define. (warning, error, fatal_error, pedwarn, sorry, inform, error_for_asm, warning_for_asm): Mark with ATTRIBUTE_GCC_CXXDIAG. cp: * cp-tree.h (GCC_DIAG_STYLE, ATTRIBUTE_GCC_CXXDIAG): Define. (cp_error_at, cp_warning_at, cp_pedwarn_at): Mark with ATTRIBUTE_GCC_CXXDIAG. From-SVN: r68910
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/c-aux-info.c2
-rw-r--r--gcc/c-common.c6
-rw-r--r--gcc/c-semantics.c4
-rw-r--r--gcc/c-tree.h5
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/cp-tree.h18
-rw-r--r--gcc/diagnostic.h1
-rw-r--r--gcc/jump.c2
-rw-r--r--gcc/toplev.h31
10 files changed, 70 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c85ed81..b9d07ec 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+2003-07-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * c-aux-info.c: Include toplev.h after c-tree.h.
+ * c-common.c: Likewise.
+ (GCC_DIAG_STYLE): Undef.
+ * c-semantics.c (GCC_DIAG_STYLE): Define.
+ * c-tree.h (GCC_DIAG_STYLE): Likewise.
+ * diagnostic.h (inform): Move prototype to toplev.h.
+ * jump.c: Include diagnostic.h before toplev.h.
+ * toplev.h (GCC_DIAG_STYLE, ATTRIBUTE_GCC_DIAG): Define.
+ (warning, error, fatal_error, pedwarn, sorry, inform,
+ error_for_asm, warning_for_asm): Mark with ATTRIBUTE_GCC_CXXDIAG.
+
2003-07-03 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* cfglayout.c (cfg_layout_duplicate_bb): Do not update frequencies
diff --git a/gcc/c-aux-info.c b/gcc/c-aux-info.c
index b0a9ef0..e785ade 100644
--- a/gcc/c-aux-info.c
+++ b/gcc/c-aux-info.c
@@ -26,10 +26,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "toplev.h"
#include "flags.h"
#include "tree.h"
#include "c-tree.h"
+#include "toplev.h"
enum formals_style_enum {
ansi,
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 9e03765..6513ca8 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -26,7 +26,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "intl.h"
#include "tree.h"
#include "flags.h"
-#include "toplev.h"
#include "output.h"
#include "c-pragma.h"
#include "rtl.h"
@@ -42,6 +41,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "langhooks.h"
#include "tree-inline.h"
#include "c-tree.h"
+/* In order to ensure we use a common subset of valid specifiers
+ (between the various C family frontends) in this file, we restrict
+ ourselves to the generic specifier set. */
+#undef GCC_DIAG_STYLE
+#include "toplev.h"
cpp_reader *parse_in; /* Declared in c-pragma.h. */
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
index e292d9f..4e27bec 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-semantics.c
@@ -31,6 +31,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "varray.h"
#include "c-common.h"
#include "except.h"
+/* In order for the format checking to accept the C frontend
+ diagnostic framework extensions, you must define this token before
+ including toplev.h. */
+#define GCC_DIAG_STYLE __gcc_cdiag__
#include "toplev.h"
#include "flags.h"
#include "ggc.h"
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index f32eb11..593877a 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -305,4 +305,9 @@ extern void c_finish_incomplete_decl (tree);
extern GTY(()) tree static_ctors;
extern GTY(()) tree static_dtors;
+/* In order for the format checking to accept the C frontend
+ diagnostic framework extensions, you must include this file before
+ toplev.h, not after. */
+#define GCC_DIAG_STYLE __gcc_cdiag__
+
#endif /* ! GCC_C_TREE_H */
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1e75a34..ba6abbe 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2003-07-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (GCC_DIAG_STYLE, ATTRIBUTE_GCC_CXXDIAG): Define.
+ (cp_error_at, cp_warning_at, cp_pedwarn_at): Mark with
+ ATTRIBUTE_GCC_CXXDIAG.
+
2003-07-03 Mark Mitchell <mark@codesourcery.com>
* call.c (build_scoped_method_call): Use convert_to_void.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 8612b8c..1620015 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3802,10 +3802,6 @@ extern tree set_guard (tree);
extern void prepare_assemble_variable (tree);
extern void lower_function (tree);
-extern void cp_error_at (const char *msgid, ...);
-extern void cp_warning_at (const char *msgid, ...);
-extern void cp_pedwarn_at (const char *msgid, ...);
-
/* XXX Not i18n clean. */
#define cp_deprecated(STR) \
do { \
@@ -4344,4 +4340,18 @@ extern bool cp_dump_tree (void *, tree);
/* -- end of C++ */
+/* In order for the format checking to accept the C++ frontend
+ diagnostic framework extensions, you must include this file before
+ toplev.h, not after. */
+#define GCC_DIAG_STYLE __gcc_cxxdiag__
+#if GCC_VERSION >= 3004
+#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
+
+extern void cp_error_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2);
+extern void cp_warning_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2);
+extern void cp_pedwarn_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2);
+
#endif /* ! GCC_CP_TREE_H */
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 18a11b6..73a3bd9 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -325,6 +325,5 @@ extern void output_printf (output_buffer *, const char *, ...)
extern void output_verbatim (output_buffer *, const char *, ...);
extern void verbatim (const char *, ...);
extern char *file_name_as_prefix (const char *);
-extern void inform (const char *, ...);
#endif /* ! GCC_DIAGNOSTIC_H */
diff --git a/gcc/jump.c b/gcc/jump.c
index 693e274..02a5cc7 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -50,11 +50,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "expr.h"
#include "real.h"
#include "except.h"
+#include "diagnostic.h"
#include "toplev.h"
#include "reload.h"
#include "predict.h"
#include "timevar.h"
-#include "diagnostic.h"
/* Optimize jump y; x: ... y: jumpif... x?
Don't know if it is worth bothering with. */
diff --git a/gcc/toplev.h b/gcc/toplev.h
index 9cb3746..0be768f 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -31,8 +31,6 @@ extern int read_integral_parameter (const char *, const char *,
const int);
extern void strip_off_ending (char *, int);
extern const char *trim_filename (const char *);
-extern void internal_error (const char *, ...)
- ATTRIBUTE_NORETURN;
extern void _fatal_insn_not_found (struct rtx_def *,
const char *, int,
const char *)
@@ -48,15 +46,28 @@ extern void _fatal_insn (const char *,
#define fatal_insn_not_found(insn) \
_fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
+/* If we haven't already defined a frontend specific diagnostics
+ style, use the generic one. */
+#ifndef GCC_DIAG_STYLE
+#define GCC_DIAG_STYLE __gcc_diag__
+#endif
/* None of these functions are suitable for ATTRIBUTE_PRINTF, because
each language front end can extend them with its own set of format
- specifiers. */
-extern void warning (const char *, ...);
-extern void error (const char *, ...);
-extern void fatal_error (const char *, ...)
+ specifiers. We must use custom format checks. */
+#if GCC_VERSION >= 3004
+#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)
+#endif
+extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
ATTRIBUTE_NORETURN;
-extern void pedwarn (const char *, ...);
-extern void sorry (const char *, ...);
+extern void warning (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
+extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
+extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
+ ATTRIBUTE_NORETURN;
+extern void pedwarn (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
+extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
+extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void rest_of_decl_compilation (union tree_node *,
const char *, int, int);
@@ -73,9 +84,9 @@ extern void error_with_decl (union tree_node *,
extern void announce_function (union tree_node *);
extern void error_for_asm (struct rtx_def *,
- const char *, ...);
+ const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void warning_for_asm (struct rtx_def *,
- const char *, ...);
+ const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void warn_deprecated_use (union tree_node *);
extern void output_clean_symbol_name (FILE *, const char *);