re PR c/40989 (-Werror= and #pragma diagnostics do not work with group flags)

2010-05-06  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR 40989
	* doc/invoke.texi (Wimplicit): Document as C only.
	* opts.c (common_handle_option): Add argument kind.
	(handle_option): Rename as read_cmdline_option. Factor out code to...
	(handle_option): ... here. New.
	(handle_options): Rename as read_cmdline_options.
	(decode_options): Update call.
	(set_option): Use option index instead of option pointer. Classify
	diagnostics correctly.
	(enable_warning_as_error): Call handle_option.
	* opts.h (set_option): Update declaration.
	(handle_option): Declare.
	* langhooks.h (struct lang_hooks): Add argument kind to
	handle_option.
	* c.opt (Wimplicit,Wimplicit-int): Initialize to -1.
	* c-opts.c (set_Wimplicit): Delete.
	(c_family_lang_mask): New static constant.
	(c_common_handle_option): Add argument kind. Use handle_option
	instead of set_Wimplicit.
	(c_common_post_options): warn_implicit and warn_implicit_int
	are disabled by default.
	* c-common.c (warn_implicit): Do not define here.
	* c-common.h (warn_implicit): Do not declare here.
	(c_common_handle_option): Update declaration.
	* lto-opts.c (lto_reissue_options): Update call to set_option.
java/
	* lang.c (java_handle_option): Add argument kind.
fortran/	
	* options.c (gfc_handle_option): Add argument kind.
	* gfortran.h (gfc_handle_option): Update declaration.
ada/
	* gcc-interface/misc.c (gnat_handle_option): Add argument kind.
testsuite/
	* gcc.dg/pr40989.c: New.

From-SVN: r159102
parent 2b90475a
2010-05-06 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40989
* doc/invoke.texi (Wimplicit): Document as C only.
* opts.c (common_handle_option): Add argument kind.
(handle_option): Rename as read_cmdline_option. Factor out code to...
(handle_option): ... here. New.
(handle_options): Rename as read_cmdline_options.
(decode_options): Update call.
(set_option): Use option index instead of option pointer. Classify
diagnostics correctly.
(enable_warning_as_error): Call handle_option.
* opts.h (set_option): Update declaration.
(handle_option): Declare.
* langhooks.h (struct lang_hooks): Add argument kind to
handle_option.
* c.opt (Wimplicit,Wimplicit-int): Initialize to -1.
* c-opts.c (set_Wimplicit): Delete.
(c_family_lang_mask): New static constant.
(c_common_handle_option): Add argument kind. Use handle_option
instead of set_Wimplicit.
(c_common_post_options): warn_implicit and warn_implicit_int
are disabled by default.
* c-common.c (warn_implicit): Do not define here.
* c-common.h (warn_implicit): Do not declare here.
(c_common_handle_option): Update declaration.
* lto-opts.c (lto_reissue_options): Update call to set_option.
2010-05-06 Richard Guenther <rguenther@suse.de> 2010-05-06 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43571 PR tree-optimization/43571
......
2010-05-06 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40989
* gcc-interface/misc.c (gnat_handle_option): Add argument kind.
2010-05-02 Giuseppe Scrivano <gscrivano@gnu.org> 2010-05-02 Giuseppe Scrivano <gscrivano@gnu.org>
* gnathtml.pl: Use 755 as mask for new directories. * gnathtml.pl: Use 755 as mask for new directories.
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
static bool gnat_init (void); static bool gnat_init (void);
static unsigned int gnat_init_options (unsigned int, const char **); static unsigned int gnat_init_options (unsigned int, const char **);
static int gnat_handle_option (size_t, const char *, int); static int gnat_handle_option (size_t, const char *, int, int);
static bool gnat_post_options (const char **); static bool gnat_post_options (const char **);
static alias_set_type gnat_get_alias_set (tree); static alias_set_type gnat_get_alias_set (tree);
static void gnat_print_decl (FILE *, tree, int); static void gnat_print_decl (FILE *, tree, int);
...@@ -184,7 +184,7 @@ gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED) ...@@ -184,7 +184,7 @@ gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
that have been successfully decoded or 0 on failure. */ that have been successfully decoded or 0 on failure. */
static int static int
gnat_handle_option (size_t scode, const char *arg, int value) gnat_handle_option (size_t scode, const char *arg, int value, int kind ATTRIBUTE_UNUSED)
{ {
const struct cl_option *option = &cl_options[scode]; const struct cl_option *option = &cl_options[scode];
enum opt_code code = (enum opt_code) scode; enum opt_code code = (enum opt_code) scode;
......
...@@ -427,10 +427,6 @@ int flag_threadsafe_statics = 1; ...@@ -427,10 +427,6 @@ int flag_threadsafe_statics = 1;
int flag_pretty_templates = 1; int flag_pretty_templates = 1;
/* Nonzero means warn about implicit declarations. */
int warn_implicit = 1;
/* Maximum template instantiation depth. This limit exists to limit the /* Maximum template instantiation depth. This limit exists to limit the
time it takes to notice infinite template instantiations; the default time it takes to notice infinite template instantiations; the default
value of 1024 is likely to be in the next C++ standard. */ value of 1024 is likely to be in the next C++ standard. */
......
...@@ -750,10 +750,6 @@ extern int flag_threadsafe_statics; ...@@ -750,10 +750,6 @@ extern int flag_threadsafe_statics;
extern int flag_pretty_templates; extern int flag_pretty_templates;
/* Nonzero means warn about implicit declarations. */
extern int warn_implicit;
/* Warn about using __null (as NULL in C++) as sentinel. For code compiled /* Warn about using __null (as NULL in C++) as sentinel. For code compiled
with GCC this doesn't matter as __null is guaranteed to have the right with GCC this doesn't matter as __null is guaranteed to have the right
size. */ size. */
...@@ -827,7 +823,7 @@ extern void set_Wformat (int); ...@@ -827,7 +823,7 @@ extern void set_Wformat (int);
extern tree handle_format_attribute (tree *, tree, tree, int, bool *); extern tree handle_format_attribute (tree *, tree, tree, int, bool *);
extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *); extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
extern bool attribute_takes_identifier_p (const_tree); extern bool attribute_takes_identifier_p (const_tree);
extern int c_common_handle_option (size_t code, const char *arg, int value); extern int c_common_handle_option (size_t code, const char *arg, int value, int kind);
extern bool c_common_missing_argument (const char *opt, size_t code); extern bool c_common_missing_argument (const char *opt, size_t code);
extern tree c_common_type_for_mode (enum machine_mode, int); extern tree c_common_type_for_mode (enum machine_mode, int);
extern tree c_common_type_for_size (unsigned int, int); extern tree c_common_type_for_size (unsigned int, int);
......
...@@ -106,7 +106,6 @@ static size_t deferred_count; ...@@ -106,7 +106,6 @@ static size_t deferred_count;
/* Number of deferred options scanned for -include. */ /* Number of deferred options scanned for -include. */
static size_t include_cursor; static size_t include_cursor;
static void set_Wimplicit (int);
static void handle_OPT_d (const char *); static void handle_OPT_d (const char *);
static void set_std_cxx98 (int); static void set_std_cxx98 (int);
static void set_std_cxx0x (int); static void set_std_cxx0x (int);
...@@ -135,6 +134,10 @@ static struct deferred_opt ...@@ -135,6 +134,10 @@ static struct deferred_opt
const char *arg; const char *arg;
} *deferred_opts; } *deferred_opts;
static const unsigned int
c_family_lang_mask = (CL_C | CL_CXX | CL_ObjC | CL_ObjCXX);
/* Complain that switch CODE expects an argument but none was /* Complain that switch CODE expects an argument but none was
provided. OPT was the command-line option. Return FALSE to get provided. OPT was the command-line option. Return FALSE to get
the default message in opts.c, TRUE if we provide a specialized the default message in opts.c, TRUE if we provide a specialized
...@@ -349,7 +352,8 @@ c_common_init_options (unsigned int argc, const char **argv) ...@@ -349,7 +352,8 @@ c_common_init_options (unsigned int argc, const char **argv)
invalid, a negative number to prevent language-independent invalid, a negative number to prevent language-independent
processing in toplev.c (a hack necessary for the short-term). */ processing in toplev.c (a hack necessary for the short-term). */
int int
c_common_handle_option (size_t scode, const char *arg, int value) c_common_handle_option (size_t scode, const char *arg, int value,
int kind)
{ {
const struct cl_option *option = &cl_options[scode]; const struct cl_option *option = &cl_options[scode];
enum opt_code code = (enum opt_code) scode; enum opt_code code = (enum opt_code) scode;
...@@ -362,7 +366,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) ...@@ -362,7 +366,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
switch (code) switch (code)
{ {
default: default:
if (cl_options[code].flags & (CL_C | CL_CXX | CL_ObjC | CL_ObjCXX)) if (cl_options[code].flags & c_family_lang_mask)
{ {
if ((option->flags & CL_TARGET) if ((option->flags & CL_TARGET)
&& ! targetcm.handle_c_option (scode, arg, value)) && ! targetcm.handle_c_option (scode, arg, value))
...@@ -471,7 +475,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) ...@@ -471,7 +475,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
case OPT_Wall: case OPT_Wall:
warn_unused = value; warn_unused = value;
set_Wformat (value); set_Wformat (value);
set_Wimplicit (value); handle_option (OPT_Wimplicit, value, NULL, c_family_lang_mask, kind);
warn_char_subscripts = value; warn_char_subscripts = value;
warn_missing_braces = value; warn_missing_braces = value;
warn_parentheses = value; warn_parentheses = value;
...@@ -569,7 +573,13 @@ c_common_handle_option (size_t scode, const char *arg, int value) ...@@ -569,7 +573,13 @@ c_common_handle_option (size_t scode, const char *arg, int value)
break; break;
case OPT_Wimplicit: case OPT_Wimplicit:
set_Wimplicit (value); gcc_assert (value == 0 || value == 1);
if (warn_implicit_int == -1)
handle_option (OPT_Wimplicit_int, value, NULL,
c_family_lang_mask, kind);
if (warn_implicit_function_declaration == -1)
handle_option (OPT_Wimplicit_function_declaration, value, NULL,
c_family_lang_mask, kind);
break; break;
case OPT_Wimport: case OPT_Wimport:
...@@ -1246,6 +1256,12 @@ c_common_post_options (const char **pfilename) ...@@ -1246,6 +1256,12 @@ c_common_post_options (const char **pfilename)
"-Wformat-security ignored without -Wformat"); "-Wformat-security ignored without -Wformat");
} }
if (warn_implicit == -1)
warn_implicit = 0;
if (warn_implicit_int == -1)
warn_implicit_int = 0;
/* -Wimplicit-function-declaration is enabled by default for C99. */ /* -Wimplicit-function-declaration is enabled by default for C99. */
if (warn_implicit_function_declaration == -1) if (warn_implicit_function_declaration == -1)
warn_implicit_function_declaration = flag_isoc99; warn_implicit_function_declaration = flag_isoc99;
...@@ -1766,15 +1782,6 @@ set_std_cxx0x (int iso) ...@@ -1766,15 +1782,6 @@ set_std_cxx0x (int iso)
cxx_dialect = cxx0x; cxx_dialect = cxx0x;
} }
/* Handle setting implicit to ON. */
static void
set_Wimplicit (int on)
{
warn_implicit = on;
warn_implicit_int = on;
warn_implicit_function_declaration = on;
}
/* Args to -d specify what to dump. Silently ignore /* Args to -d specify what to dump. Silently ignore
unrecognized options; they may be aimed at toplev.c. */ unrecognized options; they may be aimed at toplev.c. */
static void static void
......
...@@ -263,14 +263,15 @@ C ObjC C++ ObjC++ Var(warn_init_self) Warning ...@@ -263,14 +263,15 @@ C ObjC C++ ObjC++ Var(warn_init_self) Warning
Warn about variables which are initialized to themselves Warn about variables which are initialized to themselves
Wimplicit Wimplicit
C ObjC C++ ObjC++ Warning C ObjC Var(warn_implicit) Init(-1) Warning
Warn about implicit declarations
Wimplicit-function-declaration Wimplicit-function-declaration
C ObjC Var(warn_implicit_function_declaration) Init(-1) Warning C ObjC Var(warn_implicit_function_declaration) Init(-1) Warning
Warn about implicit function declarations Warn about implicit function declarations
Wimplicit-int Wimplicit-int
C ObjC Var(warn_implicit_int) Warning C ObjC Var(warn_implicit_int) Init(-1) Warning
Warn when a declaration does not specify a type Warn when a declaration does not specify a type
Wimport Wimport
......
...@@ -2901,8 +2901,8 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}. ...@@ -2901,8 +2901,8 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
-Wc++0x-compat @gol -Wc++0x-compat @gol
-Wchar-subscripts @gol -Wchar-subscripts @gol
-Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol -Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
-Wimplicit-int @gol -Wimplicit-int @r{(C and Objective-C only)} @gol
-Wimplicit-function-declaration @gol -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
-Wcomment @gol -Wcomment @gol
-Wformat @gol -Wformat @gol
-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
...@@ -3145,7 +3145,7 @@ enabled by default and it is made into an error by ...@@ -3145,7 +3145,7 @@ enabled by default and it is made into an error by
@option{-pedantic-errors}. This warning is also enabled by @option{-pedantic-errors}. This warning is also enabled by
@option{-Wall}. @option{-Wall}.
@item -Wimplicit @item -Wimplicit @r{(C and Objective-C only)}
@opindex Wimplicit @opindex Wimplicit
@opindex Wno-implicit @opindex Wno-implicit
Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
......
2010-05-0 Tobias Burnus <burnus@net-b.de> 2010-05-06 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40989
* options.c (gfc_handle_option): Add argument kind.
* gfortran.h (gfc_handle_option): Update declaration.
2010-05-06 Tobias Burnus <burnus@net-b.de>
PR fortran/43985 PR fortran/43985
* trans-types.c (gfc_sym_type): Mark Cray pointees as * trans-types.c (gfc_sym_type): Mark Cray pointees as
......
...@@ -2310,7 +2310,7 @@ int get_c_kind (const char *, CInteropKind_t *); ...@@ -2310,7 +2310,7 @@ int get_c_kind (const char *, CInteropKind_t *);
/* options.c */ /* options.c */
unsigned int gfc_init_options (unsigned int, const char **); unsigned int gfc_init_options (unsigned int, const char **);
int gfc_handle_option (size_t, const char *, int); int gfc_handle_option (size_t, const char *, int, int);
bool gfc_post_options (const char **); bool gfc_post_options (const char **);
/* f95-lang.c */ /* f95-lang.c */
......
...@@ -532,7 +532,8 @@ gfc_handle_runtime_check_option (const char *arg) ...@@ -532,7 +532,8 @@ gfc_handle_runtime_check_option (const char *arg)
recognized and handled. */ recognized and handled. */
int int
gfc_handle_option (size_t scode, const char *arg, int value) gfc_handle_option (size_t scode, const char *arg, int value,
int kind ATTRIBUTE_UNUSED)
{ {
int result = 1; int result = 1;
enum opt_code code = (enum opt_code) scode; enum opt_code code = (enum opt_code) scode;
......
2010-05-06 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40989
* lang.c (java_handle_option): Add argument kind.
2010-04-18 Eric Botcazou <ebotcazou@adacore.com> 2010-04-18 Eric Botcazou <ebotcazou@adacore.com>
* decl.c (java_init_decl_processing): Remove argument in call to * decl.c (java_init_decl_processing): Remove argument in call to
......
...@@ -52,7 +52,7 @@ static void java_finish (void); ...@@ -52,7 +52,7 @@ static void java_finish (void);
static unsigned int java_init_options (unsigned int, const char **); static unsigned int java_init_options (unsigned int, const char **);
static bool java_post_options (const char **); static bool java_post_options (const char **);
static int java_handle_option (size_t scode, const char *arg, int value); static int java_handle_option (size_t scode, const char *arg, int value, int kind);
static void put_decl_string (const char *, int); static void put_decl_string (const char *, int);
static void put_decl_node (tree, int); static void put_decl_node (tree, int);
static void java_print_error_function (diagnostic_context *, const char *, static void java_print_error_function (diagnostic_context *, const char *,
...@@ -175,7 +175,8 @@ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; ...@@ -175,7 +175,8 @@ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
* return 0, but do not complain if the option is not recognized. * return 0, but do not complain if the option is not recognized.
*/ */
static int static int
java_handle_option (size_t scode, const char *arg, int value) java_handle_option (size_t scode, const char *arg, int value,
int kind ATTRIBUTE_UNUSED)
{ {
enum opt_code code = (enum opt_code) scode; enum opt_code code = (enum opt_code) scode;
......
...@@ -283,7 +283,7 @@ struct lang_hooks ...@@ -283,7 +283,7 @@ struct lang_hooks
Return 1 if the switch is valid, 0 if invalid, and -1 if it's Return 1 if the switch is valid, 0 if invalid, and -1 if it's
valid and should not be treated as language-independent too. */ valid and should not be treated as language-independent too. */
int (*handle_option) (size_t code, const char *arg, int value); int (*handle_option) (size_t code, const char *arg, int value, int kind);
/* Return false to use the default complaint about a missing /* Return false to use the default complaint about a missing
argument, otherwise output a complaint and return true. */ argument, otherwise output a complaint and return true. */
......
...@@ -383,7 +383,7 @@ lto_reissue_options (void) ...@@ -383,7 +383,7 @@ lto_reissue_options (void)
const struct cl_option *option = &cl_options[o->code]; const struct cl_option *option = &cl_options[o->code];
if (option->flag_var) if (option->flag_var)
set_option (option, o->value, o->arg); set_option (o->code, o->value, o->arg, 0 /*DK_UNSPECIFIED*/);
if (o->type == CL_TARGET) if (o->type == CL_TARGET)
targetm.handle_option (o->code, o->arg, o->value); targetm.handle_option (o->code, o->arg, o->value);
......
...@@ -372,13 +372,11 @@ const char **in_fnames; ...@@ -372,13 +372,11 @@ const char **in_fnames;
unsigned num_in_fnames; unsigned num_in_fnames;
static int common_handle_option (size_t scode, const char *arg, int value, static int common_handle_option (size_t scode, const char *arg, int value,
unsigned int lang_mask); unsigned int lang_mask, int kind);
static void handle_param (const char *); static void handle_param (const char *);
static unsigned int handle_option (const char **argv, unsigned int lang_mask);
static char *write_langs (unsigned int lang_mask); static char *write_langs (unsigned int lang_mask);
static void complain_wrong_lang (const char *, const struct cl_option *, static void complain_wrong_lang (const char *, const struct cl_option *,
unsigned int lang_mask); unsigned int lang_mask);
static void handle_options (unsigned int, const char **, unsigned int);
static void set_debug_level (enum debug_info_type type, int extended, static void set_debug_level (enum debug_info_type type, int extended,
const char *arg); const char *arg);
...@@ -485,10 +483,51 @@ void print_ignored_options (void) ...@@ -485,10 +483,51 @@ void print_ignored_options (void)
input_location = saved_loc; input_location = saved_loc;
} }
/* Handle option OPT_INDEX, and argument ARG, for the language
indicated by LANG_MASK. VALUE is true, unless no- form of an -f or
-W option was given. KIND is the diagnostic_t if this is a
diagnostics option, DK_UNSPECIFIED otherwise. Returns false if the
switch was invalid. */
bool
handle_option (int opt_index, int value, const char *arg,
unsigned int lang_mask, int kind)
{
const struct cl_option *option = &cl_options[opt_index];
if (option->flag_var)
set_option (opt_index, value, arg, kind);
if (option->flags & lang_mask)
{
if (lang_hooks.handle_option (opt_index, arg, value, kind) == 0)
return false;
else
lto_register_user_option (opt_index, arg, value, lang_mask);
}
if (option->flags & CL_COMMON)
{
if (common_handle_option (opt_index, arg, value, lang_mask, kind) == 0)
return false;
else
lto_register_user_option (opt_index, arg, value, CL_COMMON);
}
if (option->flags & CL_TARGET)
{
if (!targetm.handle_option (opt_index, arg, value))
return false;
else
lto_register_user_option (opt_index, arg, value, CL_TARGET);
}
return true;
}
/* Handle the switch beginning at ARGV for the language indicated by /* Handle the switch beginning at ARGV for the language indicated by
LANG_MASK. Returns the number of switches consumed. */ LANG_MASK. Returns the number of switches consumed. */
static unsigned int static unsigned int
handle_option (const char **argv, unsigned int lang_mask) read_cmdline_option (const char **argv, unsigned int lang_mask)
{ {
size_t opt_index; size_t opt_index;
const char *opt, *arg = 0; const char *opt, *arg = 0;
...@@ -609,32 +648,8 @@ handle_option (const char **argv, unsigned int lang_mask) ...@@ -609,32 +648,8 @@ handle_option (const char **argv, unsigned int lang_mask)
} }
} }
if (option->flag_var) if (!handle_option (opt_index, value, arg, lang_mask, DK_UNSPECIFIED))
set_option (option, value, arg);
if (option->flags & lang_mask)
{
if (lang_hooks.handle_option (opt_index, arg, value) == 0)
result = 0;
else
lto_register_user_option (opt_index, arg, value, lang_mask);
}
if (result && (option->flags & CL_COMMON))
{
if (common_handle_option (opt_index, arg, value, lang_mask) == 0)
result = 0;
else
lto_register_user_option (opt_index, arg, value, CL_COMMON);
}
if (result && (option->flags & CL_TARGET))
{
if (!targetm.handle_option (opt_index, arg, value))
result = 0; result = 0;
else
lto_register_user_option (opt_index, arg, value, CL_TARGET);
}
done: done:
if (dup) if (dup)
...@@ -735,7 +750,7 @@ flag_instrument_functions_exclude_p (tree fndecl) ...@@ -735,7 +750,7 @@ flag_instrument_functions_exclude_p (tree fndecl)
contains has a single bit set representing the current contains has a single bit set representing the current
language. */ language. */
static void static void
handle_options (unsigned int argc, const char **argv, unsigned int lang_mask) read_cmdline_options (unsigned int argc, const char **argv, unsigned int lang_mask)
{ {
unsigned int n, i; unsigned int n, i;
...@@ -757,7 +772,7 @@ handle_options (unsigned int argc, const char **argv, unsigned int lang_mask) ...@@ -757,7 +772,7 @@ handle_options (unsigned int argc, const char **argv, unsigned int lang_mask)
continue; continue;
} }
n = handle_option (argv + i, lang_mask); n = read_cmdline_option (argv + i, lang_mask);
if (!n) if (!n)
{ {
...@@ -973,7 +988,7 @@ decode_options (unsigned int argc, const char **argv) ...@@ -973,7 +988,7 @@ decode_options (unsigned int argc, const char **argv)
OPTIMIZATION_OPTIONS (optimize, optimize_size); OPTIMIZATION_OPTIONS (optimize, optimize_size);
#endif #endif
handle_options (argc, argv, lang_mask); read_cmdline_options (argc, argv, lang_mask);
if (dump_base_name && ! IS_ABSOLUTE_PATH (dump_base_name)) if (dump_base_name && ! IS_ABSOLUTE_PATH (dump_base_name))
{ {
...@@ -1467,7 +1482,7 @@ print_specific_help (unsigned int include_flags, ...@@ -1467,7 +1482,7 @@ print_specific_help (unsigned int include_flags,
static int static int
common_handle_option (size_t scode, const char *arg, int value, common_handle_option (size_t scode, const char *arg, int value,
unsigned int lang_mask) unsigned int lang_mask, int kind ATTRIBUTE_UNUSED)
{ {
static bool verbose = false; static bool verbose = false;
enum opt_code code = (enum opt_code) scode; enum opt_code code = (enum opt_code) scode;
...@@ -2376,8 +2391,10 @@ get_option_state (int option, struct cl_option_state *state) ...@@ -2376,8 +2391,10 @@ get_option_state (int option, struct cl_option_state *state)
/* Set *OPTION according to VALUE and ARG. */ /* Set *OPTION according to VALUE and ARG. */
void void
set_option (const struct cl_option *option, int value, const char *arg) set_option (int opt_index, int value, const char *arg, int kind)
{ {
const struct cl_option *option = &cl_options[opt_index];
if (!option->flag_var) if (!option->flag_var)
return; return;
...@@ -2407,6 +2424,9 @@ set_option (const struct cl_option *option, int value, const char *arg) ...@@ -2407,6 +2424,9 @@ set_option (const struct cl_option *option, int value, const char *arg)
*(const char **) option->flag_var = arg; *(const char **) option->flag_var = arg;
break; break;
} }
if ((diagnostic_t)kind != DK_UNSPECIFIED)
diagnostic_classify_diagnostic (global_dc, opt_index, (diagnostic_t)kind);
} }
...@@ -2450,8 +2470,8 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask) ...@@ -2450,8 +2470,8 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask)
const struct cl_option * const option = cl_options + option_index; const struct cl_option * const option = cl_options + option_index;
/* -Werror=foo implies -Wfoo. */ /* -Werror=foo implies -Wfoo. */
if (option->var_type == CLVC_BOOLEAN && option->flag_var) if (option->var_type == CLVC_BOOLEAN)
*(int *) option->flag_var = 1; handle_option (option_index, value, arg, lang_mask, (int)kind);
if (warning_as_error_callback) if (warning_as_error_callback)
warning_as_error_callback (option_index); warning_as_error_callback (option_index);
......
...@@ -103,8 +103,9 @@ extern void prune_options (int *argcp, char ***argvp); ...@@ -103,8 +103,9 @@ extern void prune_options (int *argcp, char ***argvp);
extern void decode_options (unsigned int argc, const char **argv); extern void decode_options (unsigned int argc, const char **argv);
extern int option_enabled (int opt_idx); extern int option_enabled (int opt_idx);
extern bool get_option_state (int, struct cl_option_state *); extern bool get_option_state (int, struct cl_option_state *);
extern void set_option (const struct cl_option *, int, const char *); extern void set_option (int opt_index, int value, const char *arg, int);
bool handle_option (int opt_index, int value, const char *arg,
unsigned int lang_mask, int kind);
extern void register_warning_as_error_callback (void (*callback) (int)); extern void register_warning_as_error_callback (void (*callback) (int));
extern void enable_warning_as_error (const char *arg, int value, extern void enable_warning_as_error (const char *arg, int value,
unsigned int lang_mask); unsigned int lang_mask);
......
2010-05-06 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40989
* gcc.dg/pr40989.c: New.
2010-05-06 Richard Guenther <rguenther@suse.de> 2010-05-06 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43934 PR tree-optimization/43934
......
/* { dg-do compile } */
/* { dg-options "-Werror=implicit" } */
int main() {
return pippo(); /* { dg-error "" } */
}
/* { dg-message "warnings being treated as errors" "" { target *-*-* } 0 } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment