diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-08-13 10:19:03 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-08-13 10:19:03 +0000 |
commit | 85790e667775932ee784b9c1636dafcc66ac32d3 (patch) | |
tree | 1628ba21d162d8c904b22105327717febc42c784 /gcc/diagnostic.c | |
parent | 374035cb20b323d0e95559499fc0089aa4cedff9 (diff) | |
download | gcc-85790e667775932ee784b9c1636dafcc66ac32d3.zip gcc-85790e667775932ee784b9c1636dafcc66ac32d3.tar.gz gcc-85790e667775932ee784b9c1636dafcc66ac32d3.tar.bz2 |
re PR c/15236 (pedantic switch modifies treatment of non-ISO compliant enumerations)
2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/15236
* diagnostic.c (pedwarn_at): New.
* toplev.h (pedwarn_at): Declare.
* c-tree.h (build_enumerator): Update declaration.
* c-decl.c (finish_enum): Update comment.
(build_enumerator): Take a location parameter. Give a pedwarn but do
not perform any conversion.
* c-parser.c (c_parser_enum_specifier): Set correct location for
enumerator.
testsuite/
* gcc.dg/pr15236.c: New.
* gcc.dg/torture/pr25183.c: Update.
From-SVN: r139050
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r-- | gcc/diagnostic.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index cb4c67a..54c2da7 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -537,10 +537,10 @@ warning_at (location_t location, int opt, const char *gmsgid, ...) return report_diagnostic (&diagnostic); } -/* A "pedantic" warning: issues a warning unless -pedantic-errors was - given on the command line, in which case it issues an error. Use - this for diagnostics required by the relevant language standard, - if you have chosen not to make them errors. +/* A "pedantic" warning at LOCATION: issues a warning unless + -pedantic-errors was given on the command line, in which case it + issues an error. Use this for diagnostics required by the relevant + language standard, if you have chosen not to make them errors. Note that these diagnostics are issued independent of the setting of the -pedantic command-line switch. To get a warning enabled @@ -551,6 +551,21 @@ warning_at (location_t location, int opt, const char *gmsgid, ...) Returns true if the warning was printed, false if it was inhibited. */ bool +pedwarn_at (location_t location, int opt, const char *gmsgid, ...) +{ + diagnostic_info diagnostic; + va_list ap; + + va_start (ap, gmsgid); + diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_PEDWARN); + diagnostic.option_index = opt; + va_end (ap); + return report_diagnostic (&diagnostic); +} + +/* Equivalent to pedwarn_at using INPUT_LOCATION. */ + +bool pedwarn (int opt, const char *gmsgid, ...) { diagnostic_info diagnostic; |