summaryrefslogtreecommitdiff
path: root/gcc/c/c-errors.c
diff options
context:
space:
mode:
authormiyuki <miyuki@138bc75d-0d04-0410-961f-82ee72b054a4>2016-05-11 20:23:37 +0000
committermiyuki <miyuki@138bc75d-0d04-0410-961f-82ee72b054a4>2016-05-11 20:23:37 +0000
commit54c4d22ec4b041a9a5a69d5a3bacf6649e615a23 (patch)
tree53be56313df606591b5a5db27a863bed98dc7f1a /gcc/c/c-errors.c
parent57215d5b85193c6b0a4dfdc6ac86f586b1e80a94 (diff)
PR43651: add warning for duplicate qualifier
gcc/c/ PR c/43651 * c-decl.c (declspecs_add_qual): Warn when -Wduplicate-decl-specifier is enabled. * c-errors.c (pedwarn_c90): Return true if warned. * c-tree.h (pedwarn_c90): Change return type to bool. (enum c_declspec_word): Add new enumerator cdw_atomic. gcc/ PR c/43651 * doc/invoke.texi (Wduplicate-decl-specifier): Document new option. gcc/testsuite/ PR c/43651 * gcc.dg/Wduplicate-decl-specifier-c11.c: New test. * gcc.dg/Wduplicate-decl-specifier.c: Likewise. gcc/c-family/ PR c/43651 * c.opt (Wduplicate-decl-specifier): New option. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@236142 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c/c-errors.c')
-rw-r--r--gcc/c/c-errors.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/c/c-errors.c b/gcc/c/c-errors.c
index d5e78b875eed..af157c00fc83 100644
--- a/gcc/c/c-errors.c
+++ b/gcc/c/c-errors.c
@@ -71,11 +71,12 @@ pedwarn_c99 (location_t location, int opt, const char *gmsgid, ...)
ISO C99 but not supported in ISO C90, thus we explicitly don't pedwarn
when C99 is specified. (There is no flag_c90.) */
-void
+bool
pedwarn_c90 (location_t location, int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
+ bool warned = false;
rich_location richloc (line_table, location);
va_start (ap, gmsgid);
@@ -92,6 +93,7 @@ pedwarn_c90 (location_t location, int opt, const char *gmsgid, ...)
? DK_PEDWARN : DK_WARNING);
diagnostic.option_index = opt;
report_diagnostic (&diagnostic);
+ warned = true;
goto out;
}
}
@@ -114,7 +116,9 @@ pedwarn_c90 (location_t location, int opt, const char *gmsgid, ...)
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN);
diagnostic.option_index = opt;
report_diagnostic (&diagnostic);
+ warned = true;
}
out:
va_end (ap);
+ return warned;
}