summaryrefslogtreecommitdiff
path: root/gcc/c-errors.c
diff options
context:
space:
mode:
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-28 20:03:25 +0000
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-28 20:03:25 +0000
commitaa267cf692d8164823858115027a41f20eb35b46 (patch)
tree0f1c19fbece8d2a5b50b52eb0fd803ccfc083558 /gcc/c-errors.c
parentf3e45380e1e881b8e1106ea446547cd99169b460 (diff)
downloadgcc-aa267cf692d8164823858115027a41f20eb35b46.tar.gz
* c-parse.in (lineno_stmt_decl_or_labels_ending_decl): Also warn
when warn_declaration_after_statement. Call pedwarn_c90, not pedwarn. Correct message: it's "ISO C90", not "ISO C89". * c-common.c (warn_declaration_after_statement): Define. * c-common.h (warn_declaration_after_statement): Declare. * c.opt (Wdeclaration-after-statement): New. * c-errors.c (pedwarn_c90): New function. * c-opts.c (c_common_handle_option) <case OPT_Wdeclaration_after_statement>: New. * c-tree.h (pedwarn_c90): Declare. * doc/invoke.texi (Option Summary): Document -Wdeclaration-after-statement. (Warning Options): Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69899 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-errors.c')
-rw-r--r--gcc/c-errors.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/c-errors.c b/gcc/c-errors.c
index 2a2fdc0c440..fa71b8cfa97 100644
--- a/gcc/c-errors.c
+++ b/gcc/c-errors.c
@@ -43,3 +43,21 @@ pedwarn_c99 (const char *msgid, ...)
report_diagnostic (&diagnostic);
va_end (ap);
}
+
+/* Issue an ISO C90 pedantic warning MSGID. This function is supposed to
+ be used for matters that are allowed in ISO C99 but not supported in
+ ISO C90, thus we explicitly don't pedwarn when C99 is specified.
+ (There is no flag_c90.) */
+
+void
+pedwarn_c90 (const char *msgid, ...)
+{
+ diagnostic_info diagnostic;
+ va_list ap;
+
+ va_start (ap, msgid);
+ diagnostic_set_info (&diagnostic, msgid, &ap, input_location,
+ flag_isoc99 ? DK_WARNING : pedantic_error_kind ());
+ report_diagnostic (&diagnostic);
+ va_end (ap);
+}