aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-11-11 16:54:49 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2010-11-11 16:54:49 +0000
commitf954bd2c81520966ffccdd2786bab6415bd6f6ac (patch)
tree2057187053c110209cde5ca5305225655fda8d8f /gcc
parenta5f09e731173ce7b5fbe6731b0afde5390663147 (diff)
downloadgcc-f954bd2c81520966ffccdd2786bab6415bd6f6ac.zip
gcc-f954bd2c81520966ffccdd2786bab6415bd6f6ac.tar.gz
gcc-f954bd2c81520966ffccdd2786bab6415bd6f6ac.tar.bz2
opts.c (warning_as_error_callback, [...]): Remove.
* opts.c (warning_as_error_callback, register_warning_as_error_callback): Remove. (enable_warning_as_error): Don't use warning_as_error_callback. * opts.h (register_warning_as_error_callback): Remove. c-family: * c-opts.c (warning_as_error_callback): Remove. (c_common_initialize_diagnostics): Don't call register_warning_as_error_callback. (c_common_handle_option): Handle -Werror=normalized= here. testsuite: * gcc.dg/cpp/warn-normalized-3.c: Update expected note text. From-SVN: r166606
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/c-family/ChangeLog7
-rw-r--r--gcc/c-family/c-opts.c115
-rw-r--r--gcc/opts.c16
-rw-r--r--gcc/opts.h1
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c2
7 files changed, 38 insertions, 114 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3dd3047..d60e21c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2010-11-11 Joseph Myers <joseph@codesourcery.com>
+
+ * opts.c (warning_as_error_callback,
+ register_warning_as_error_callback): Remove.
+ (enable_warning_as_error): Don't use warning_as_error_callback.
+ * opts.h (register_warning_as_error_callback): Remove.
+
2010-11-11 Richard Henderson <rth@redhat.com>
* tree-ssa-math-opts.c (convert_mult_to_fma): Handle a NEGATE_EXPR
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 80a10a3..a9a55b3 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,10 @@
+2010-11-11 Joseph Myers <joseph@codesourcery.com>
+
+ * c-opts.c (warning_as_error_callback): Remove.
+ (c_common_initialize_diagnostics): Don't call
+ register_warning_as_error_callback.
+ (c_common_handle_option): Handle -Werror=normalized= here.
+
2010-11-10 Joseph Myers <joseph@codesourcery.com>
* c-common.c (handle_mode_attribute): Use %' and word "signedness"
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index b4b7779..1a281c8 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -144,89 +144,6 @@ defer_opt (enum opt_code code, const char *arg)
deferred_count++;
}
-/* -Werror= may set a warning option to enable a warning that is emitted
- by the preprocessor. Set any corresponding flag in cpp_opts. */
-
-static void
-warning_as_error_callback (int option_index)
-{
- switch (option_index)
- {
- default:
- /* Ignore options not associated with the preprocessor. */
- break;
-
- case OPT_Wdeprecated:
- cpp_opts->cpp_warn_deprecated = 1;
- break;
-
- case OPT_Wcomment:
- cpp_opts->warn_comments = 1;
- break;
-
- case OPT_Wtrigraphs:
- cpp_opts->warn_trigraphs = 1;
- break;
-
- case OPT_Wmultichar:
- cpp_opts->warn_multichar = 1;
- break;
-
- case OPT_Wtraditional:
- cpp_opts->cpp_warn_traditional = 1;
- break;
-
- case OPT_Wlong_long:
- cpp_opts->cpp_warn_long_long = 1;
- break;
-
- case OPT_Wendif_labels:
- cpp_opts->warn_endif_labels = 1;
- break;
-
- case OPT_Wvariadic_macros:
- /* Set the local flag that is used later to update cpp_opts. */
- warn_variadic_macros = 1;
- break;
-
- case OPT_Wbuiltin_macro_redefined:
- cpp_opts->warn_builtin_macro_redefined = 1;
- break;
-
- case OPT_Wundef:
- cpp_opts->warn_undef = 1;
- break;
-
- case OPT_Wunused_macros:
- /* Set the local flag that is used later to update cpp_opts. */
- warn_unused_macros = 1;
- break;
-
- case OPT_Wc___compat:
- /* Add warnings in the same way as c_common_handle_option below. */
- if (warn_enum_compare == -1)
- warn_enum_compare = 1;
- if (warn_jump_misses_init == -1)
- warn_jump_misses_init = 1;
- cpp_opts->warn_cxx_operator_names = 1;
- break;
-
- case OPT_Wnormalized_:
- inform (input_location, "-Werror=normalized=: Set -Wnormalized=nfc");
- cpp_opts->warn_normalize = normalized_C;
- break;
-
- case OPT_Winvalid_pch:
- cpp_opts->warn_invalid_pch = 1;
- break;
-
- case OPT_Wcpp:
- /* Handled by standard diagnostics using the option's associated
- boolean variable. */
- break;
- }
-}
-
/* Return language mask for option parsing. */
unsigned int
c_common_option_lang_mask (void)
@@ -240,9 +157,6 @@ c_common_option_lang_mask (void)
void
c_common_initialize_diagnostics (diagnostic_context *context)
{
- /* Register callback for warnings enabled by -Werror=. */
- register_warning_as_error_callback (warning_as_error_callback);
-
/* This is conditionalized only because that is the way the front
ends used to do it. Maybe this should be unconditional? */
if (c_dialect_cxx ())
@@ -560,17 +474,26 @@ c_common_handle_option (size_t scode, const char *arg, int value,
break;
case OPT_Wnormalized_:
- if (!value || (arg && strcasecmp (arg, "none") == 0))
- cpp_opts->warn_normalize = normalized_none;
- else if (!arg || strcasecmp (arg, "nfkc") == 0)
- cpp_opts->warn_normalize = normalized_KC;
- else if (strcasecmp (arg, "id") == 0)
- cpp_opts->warn_normalize = normalized_identifier_C;
- else if (strcasecmp (arg, "nfc") == 0)
- cpp_opts->warn_normalize = normalized_C;
+ if (kind == DK_ERROR)
+ {
+ gcc_assert (!arg);
+ inform (input_location, "-Werror=normalized=: set -Wnormalized=nfc");
+ cpp_opts->warn_normalize = normalized_C;
+ }
else
- error ("argument %qs to %<-Wnormalized%> not recognized", arg);
- break;
+ {
+ if (!value || (arg && strcasecmp (arg, "none") == 0))
+ cpp_opts->warn_normalize = normalized_none;
+ else if (!arg || strcasecmp (arg, "nfkc") == 0)
+ cpp_opts->warn_normalize = normalized_KC;
+ else if (strcasecmp (arg, "id") == 0)
+ cpp_opts->warn_normalize = normalized_identifier_C;
+ else if (strcasecmp (arg, "nfc") == 0)
+ cpp_opts->warn_normalize = normalized_C;
+ else
+ error ("argument %qs to %<-Wnormalized%> not recognized", arg);
+ break;
+ }
case OPT_Wreturn_type:
warn_return_type = value;
diff --git a/gcc/opts.c b/gcc/opts.c
index a7557ed..53ae596 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2393,19 +2393,6 @@ get_option_state (struct gcc_options *opts, int option,
return true;
}
-/* Callback function, called when -Werror= enables a warning. */
-
-static void (*warning_as_error_callback) (int) = NULL;
-
-/* Register a callback for enable_warning_as_error calls. */
-
-void
-register_warning_as_error_callback (void (*callback) (int))
-{
- gcc_assert (warning_as_error_callback == NULL || callback == NULL);
- warning_as_error_callback = callback;
-}
-
/* Enable (or disable if VALUE is 0) a warning option ARG (language
mask LANG_MASK, option handlers HANDLERS) as an error for
diagnostic context DC (possibly NULL). This is used by
@@ -2449,9 +2436,6 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask,
option_index, NULL, value, lang_mask,
(int)kind, handlers,
dc);
-
- if (warning_as_error_callback)
- warning_as_error_callback (option_index);
}
}
free (new_option);
diff --git a/gcc/opts.h b/gcc/opts.h
index ec9fbc7..069333b 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -257,7 +257,6 @@ extern void read_cmdline_option (struct gcc_options *opts,
unsigned int lang_mask,
const struct cl_option_handlers *handlers,
diagnostic_context *dc);
-extern void register_warning_as_error_callback (void (*callback) (int));
extern void enable_warning_as_error (const char *arg, int value,
unsigned int lang_mask,
const struct cl_option_handlers *handlers,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7828567..9aedbfe 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-11 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/cpp/warn-normalized-3.c: Update expected note text.
+
2010-11-11 Jakub Jelinek <jakub@redhat.com>
PR middle-end/46388
diff --git a/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c b/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c
index 24eaea0..43ea76a 100644
--- a/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c
+++ b/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c
@@ -1,5 +1,5 @@
// { dg-do preprocess }
// { dg-options "-std=gnu99 -fdiagnostics-show-option -fextended-identifiers -Werror=normalized=" }
/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */
- // { dg-prune-output ".*-Werror=normalized=: Set -Wnormalized=nfc.*" }
+ // { dg-prune-output ".*-Werror=normalized=: set -Wnormalized=nfc.*" }
\u0F43 // { dg-error "`.U00000f43' is not in NFC .-Werror=normalized=." }