+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
#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,
#include "intl.h"
#include "tree.h"
#include "flags.h"
-#include "toplev.h"
#include "output.h"
#include "c-pragma.h"
#include "rtl.h"
#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. */
#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"
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 */
+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.
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 { \
/* -- 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 */
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 */
#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. */
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 *)
#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);
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 *);