diff options
author | Mikhail Maltsev <maltsevm@gmail.com> | 2016-05-11 20:23:37 +0000 |
---|---|---|
committer | Mikhail Maltsev <miyuki@gcc.gnu.org> | 2016-05-11 20:23:37 +0000 |
commit | d6e83a8dec2b4fd3a92e87add4fa0485dd87d9f7 (patch) | |
tree | 53be56313df606591b5a5db27a863bed98dc7f1a /gcc/c/c-errors.c | |
parent | 51e67ea376b70fd41542c1540d809a32f10ed9ca (diff) | |
download | gcc-d6e83a8dec2b4fd3a92e87add4fa0485dd87d9f7.zip gcc-d6e83a8dec2b4fd3a92e87add4fa0485dd87d9f7.tar.gz gcc-d6e83a8dec2b4fd3a92e87add4fa0485dd87d9f7.tar.bz2 |
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.
From-SVN: r236142
Diffstat (limited to 'gcc/c/c-errors.c')
-rw-r--r-- | gcc/c/c-errors.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/c/c-errors.c b/gcc/c/c-errors.c index d5e78b8..af157c0 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; } |