summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-23 15:57:49 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-23 15:57:49 +0000
commit8864917d6666af0c2929572fd255b1cbeb7be8ff (patch)
treef00173dd9740a4ee5b51d4737ab407c93e441bcc /gcc/diagnostic.c
parentdb9503118f2085e94b137c88756cd91443935e34 (diff)
downloadgcc-8864917d6666af0c2929572fd255b1cbeb7be8ff.tar.gz
2008-07-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 35058 * diagnostic.c (pedwarn): Add opt parameter. (pedwarn0): New. * c-tree.h (pedwarn_init): Add opt parameter. (pedwarn_c90): Likewise. (pedwarn_c99): Likewise. * c-errors.c (pedwarn_c99): Likewise. (pedwarn_c90): Likewise. * toplev.h (pedwarn): Update declaration. (pedwarn0): Declare. * c-lex.c: All calls to pedwarn changed. * builtins.c: All calls to pedwarn changed. * toplev.c: All calls to pedwarn changed. * c-decl.c: All calls to pedwarn changed. * c-typeck.c: All calls to pedwarn changed. * c-common.c: All calls to pedwarn changed. * c-parser.c: All calls to pedwarn changed. cp/ * typeck.c: All calls to pedwarn changed. * decl.c: All calls to pedwarn changed. * call.c: All calls to pedwarn changed. * error.c: All calls to pedwarn changed. * typeck2.c: All calls to pedwarn changed. * pt.c: All calls to pedwarn changed. * name-lookup.c: All calls to pedwarn changed. * parser.c: All calls to pedwarn changed. fortran/ * f95-lang.c (gfc_mark_addressable): All calls to pedwarn changed. testsuite/ * gcc.dg/Wdeclaration-after-statement-3.c: New. * gcc/testsuite/gcc.dg/Wpointer-arith.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138089 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index c6500d81d26..49b3f9a058f 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -522,16 +522,34 @@ warning_at (location_t location, int opt, const char *gmsgid, ...)
Note that these diagnostics are issued independent of the setting
of the -pedantic command-line switch. To get a warning enabled
- only with that switch, write "if (pedantic) pedwarn (...);" */
+ only with that switch, use either "if (pedantic) pedwarn
+ (OPT_pedantic,...)" or just "pedwarn (OPT_pedantic,..)". To get a
+ pedwarn independently of the -pedantic switch use "pedwarn (0,...)". */
+
+void
+pedwarn (int opt, const char *gmsgid, ...)
+{
+ diagnostic_info diagnostic;
+ va_list ap;
+
+ va_start (ap, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
+ pedantic_warning_kind ());
+ diagnostic.option_index = opt;
+
+ report_diagnostic (&diagnostic);
+ va_end (ap);
+}
+
void
-pedwarn (const char *gmsgid, ...)
+pedwarn0 (const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
- pedantic_warning_kind ());
+ pedantic_warning_kind ());
report_diagnostic (&diagnostic);
va_end (ap);
}