diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2007-02-15 22:31:17 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2007-02-15 22:31:17 +0000 |
commit | dc90f45b24a668f465d50a4db2253c7b84cd1c2d (patch) | |
tree | 73dcde30921d36f76037d1d0106b2271a8aa2058 /gcc/c-opts.c | |
parent | 214931020be4420e7a5eb537813dc918b9cada58 (diff) | |
download | gcc-dc90f45b24a668f465d50a4db2253c7b84cd1c2d.zip gcc-dc90f45b24a668f465d50a4db2253c7b84cd1c2d.tar.gz gcc-dc90f45b24a668f465d50a4db2253c7b84cd1c2d.tar.bz2 |
re PR c/26494 (-pedantic-errors can be overridden by -W*)
2007-02-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/26494
* doc/invoke.texi (Warning Options): Remove
-Werror-implicit-function-declaration.
(Wimplicit-function-declaration): Update description.
* opts.c (common_handle_option): Move handling of -Werror=* to...
(enable_warning_as_error): ...here.
* opts.h (enable_warning_as_error): Declare.
* c-decl.c (implicit_decl_warning): Unless
-Wno-implicit-function-declaration is given, emit a pedwarn if
-std=c99 or emit a warning if -Wimplicit-function-declaration.
* c.opt (Wimplicit-function-declaration): Replace
mesg_implicit_function_declaration with
warn_implicit_function_declaration.
* c-opts.c (c_common_handle_option):
-Werror-implicit-function-declaration is exactly equal as
-Werror=implicit-function-declaration.
(set_Wimplicit): Replace mesg_implicit_function_declaration with
warn_implicit_function_declaration.
(c_common_post_options): -Wimplict-function-declaration is enabled
by default by -std=c99, otherwise is disabled by default.
* c-objc-common.c (c_objc_common_init): Remove flawed logic.
testsuite/
* gcc.dg/Wimplicit-function-declaration-c89.c: New.
* gcc.dg/Wimplicit-function-declaration-c89-default.c: New.
* gcc.dg/Wimplicit-function-declaration-c89-pedantic.c: New.
* gcc.dg/Wimplicit-function-declaration-c99.c: New.
* gcc.dg/Wimplicit-function-declaration-c99-pedantic.c: New.
* gcc.dg/Werror-implicit-function-declaration.c: New.
From-SVN: r122017
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r-- | gcc/c-opts.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 9ac433a..76ad827 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -451,8 +451,10 @@ c_common_handle_option (size_t scode, const char *arg, int value) global_dc->warning_as_error_requested = value; break; - case OPT_Werror_implicit_function_declaration: - mesg_implicit_function_declaration = 2; + case OPT_Werror_implicit_function_declaration: + /* For backward compatibility, this is the same as + -Werror=implicit-function-declaration. */ + enable_warning_as_error ("implicit-function-declaration", value, CL_C | CL_ObjC); break; case OPT_Wformat: @@ -1079,6 +1081,10 @@ c_common_post_options (const char **pfilename) "-Wformat-security ignored without -Wformat"); } + /* -Wimplicit-function-declaration is enabled by default for C99. */ + if (warn_implicit_function_declaration == -1) + warn_implicit_function_declaration = flag_isoc99; + /* C99 requires special handling of complex multiplication and division; -ffast-math and -fcx-limited-range are handled in process_options. */ if (flag_isoc99) @@ -1570,13 +1576,7 @@ set_Wimplicit (int on) { warn_implicit = on; warn_implicit_int = on; - if (on) - { - if (mesg_implicit_function_declaration != 2) - mesg_implicit_function_declaration = 1; - } - else - mesg_implicit_function_declaration = 0; + warn_implicit_function_declaration = on; } /* Args to -d specify what to dump. Silently ignore |