]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-aux-info.c: Include toplev.h after c-tree.h.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Fri, 4 Jul 2003 01:55:50 +0000 (01:55 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Fri, 4 Jul 2003 01:55:50 +0000 (01:55 +0000)
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

gcc/ChangeLog
gcc/c-aux-info.c
gcc/c-common.c
gcc/c-semantics.c
gcc/c-tree.h
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/diagnostic.h
gcc/jump.c
gcc/toplev.h

index c85ed81c6b2e3061ee80a6a443c5f7bb497040ad..b9d07ecfb424192c03a42738821c3ebea606a6f6 100644 (file)
@@ -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
index b0a9ef040b703676365df8585ead6b865b05d05c..e785ade2239c7971abdddd2fa51dbaa0d3b9fb50 100644 (file)
@@ -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,
index 9e037658507a50c48c8b74c208260daa451d7f01..6513ca81c0de8cdae3b4697ddf93c1f70b2fd562 100644 (file)
@@ -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.  */
 
index e292d9f8579e8f50e98df75683e4cb20372cabc0..4e27bec22b27f01d267def14e49e57f4e45f09ad 100644 (file)
@@ -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"
index f32eb1196f17b8024243c53866094791b41731e2..593877aee7337d466598f537383654b8306486ca 100644 (file)
@@ -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 */
index 1e75a34f95cfdd9de44093b62fd86ca4ad199060..ba6abbe154eab9ea4d79d3e0f460ab1d11b0be0d 100644 (file)
@@ -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.
index 8612b8cee20a22ca305262466d2dc7400533864f..16200156cf318f4b82bb1a277095f18c54c2f926 100644 (file)
@@ -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 */
index 18a11b673541a783f29985e2f685d36fb6f04834..73a3bd90cca85a36e7922bf602bdf87526b6c1a7 100644 (file)
@@ -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 */
index 693e274093145121b1e07caf5d8a35ed067c89c1..02a5cc72e17ff33c5877787afd66db3a13f7bcb5 100644 (file)
@@ -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.  */
index 9cb3746db9647cc2e798e9267767d6cad4526b47..0be768f18bad27e6cf63485ce887f960704ddcd2 100644 (file)
@@ -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 *);