aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPeter Maydell <pmaydell@chiark.greenend.org.uk>2008-07-10 03:51:04 +0000
committerMatthias Klose <doko@gcc.gnu.org>2008-07-10 03:51:04 +0000
commit15e1dac036941cf6f094ef8b4f11353d05968ac8 (patch)
treeb4ac0f8b506dab7f430e4dfdd07dc085a83e5dfc /gcc
parentd674c8bacd2483bbdbbd82e067b39fc09f661b1b (diff)
downloadgcc-15e1dac036941cf6f094ef8b4f11353d05968ac8.zip
gcc-15e1dac036941cf6f094ef8b4f11353d05968ac8.tar.gz
gcc-15e1dac036941cf6f094ef8b4f11353d05968ac8.tar.bz2
re PR other/28322 (GCC new warnings and compatibility)
2008-07-10 Peter Maydell <pmaydell@chiark.greenend.org.uk> PR other/28322 * opts.c (print_ignored_options): report postponed diagnostics for unknown -Wno-* options as warnings, not errors. (postpone_unknown_option_error): renamed to postpone_unknown_option_warning. * gcc.dg/pr28322-2.c: check that emitted diagnostic for -Wno-foobar is a warning and not an error. From-SVN: r137687
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/opts.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr28322-2.c2
3 files changed, 20 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e5fe0ed..3e9ce90 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2008-07-10 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+
+ PR other/28322
+ * opts.c (print_ignored_options): report postponed diagnostics for
+ unknown -Wno-* options as warnings, not errors.
+ (postpone_unknown_option_error): renamed to
+ postpone_unknown_option_warning.
+ * gcc.dg/pr28322-2.c: check that emitted diagnostic for -Wno-foobar
+ is a warning and not an error.
+
2008-07-09 Doug Kwan <dougkwan@google.com>
Revert:
diff --git a/gcc/opts.c b/gcc/opts.c
index 8431a40..7e8e96c 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -457,14 +457,17 @@ complain_wrong_lang (const char *text, const struct cl_option *option,
/* Buffer the unknown option described by the string OPT. Currently,
we only complain about unknown -Wno-* options if they may have
- prevented a diagnostic. Otherwise, we just ignore them. */
+ prevented a diagnostic. Otherwise, we just ignore them.
+ Note that if we do complain, it is only as a warning, not an error;
+ passing the compiler an unrecognised -Wno-* option should never
+ change whether the compilation succeeds or fails. */
-static void postpone_unknown_option_error(const char *opt)
+static void postpone_unknown_option_warning(const char *opt)
{
VEC_safe_push (const_char_p, heap, ignored_options, opt);
}
-/* Produce an error for each option previously buffered. */
+/* Produce a warning for each option previously buffered. */
void print_ignored_options (void)
{
@@ -476,7 +479,7 @@ void print_ignored_options (void)
{
const char *opt;
opt = VEC_pop (const_char_p, ignored_options);
- error ("unrecognized command line option \"%s\"", opt);
+ warning (0, "unrecognized command line option \"%s\"", opt);
}
input_location = saved_loc;
@@ -513,9 +516,9 @@ handle_option (const char **argv, unsigned int lang_mask)
opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET);
if (opt_index == cl_options_count && opt[1] == 'W')
{
- /* We don't generate errors for unknown -Wno-* options
+ /* We don't generate warnings for unknown -Wno-* options
unless we issue diagnostics. */
- postpone_unknown_option_error (argv[0]);
+ postpone_unknown_option_warning (argv[0]);
result = 1;
goto done;
}
diff --git a/gcc/testsuite/gcc.dg/pr28322-2.c b/gcc/testsuite/gcc.dg/pr28322-2.c
index 8fde7b2..89dd153 100644
--- a/gcc/testsuite/gcc.dg/pr28322-2.c
+++ b/gcc/testsuite/gcc.dg/pr28322-2.c
@@ -8,5 +8,5 @@ int foo (void)
return i;
}
-/* { dg-message "unrecognized command line option .-Wno-foobar." "" { target *-*-* } 0 } */
+/* { dg-warning "unrecognized command line option .-Wno-foobar." "" { target *-*-* } 0 } */