re PR middle-end/7651 (Define -Wextra strictly in terms of other warning flags)
2006-12-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR middle-end/7651 * c.opt (Wclobbered): New. * doc/invoke.texi (Wclobbered): Document it. (Wextra): Enabled by -Wextra. * c-opts.c (c_common_post_options): Enabled by -Wextra. * flow.c (rest_of_handle_life): Replace Wextra with Wclobbered. * function.c (setjmp_vars_warning): Only warn for Wclobbered. (setjmp_args_warning): Likewise. testsuite/ * gcc.dg/attr-returns_twice-1.c: Replace Wextra with Wclobbered. * gcc.dg/setjmp-1.c: Add explicit Wclobbered. From-SVN: r120151
This commit is contained in:
parent
24fc18b98c
commit
2b0017242d
9 changed files with 39 additions and 9 deletions
|
@ -1,3 +1,14 @@
|
|||
2006-12-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR middle-end/7651
|
||||
* c.opt (Wclobbered): New.
|
||||
* doc/invoke.texi (Wclobbered): Document it.
|
||||
(Wextra): Enabled by -Wextra.
|
||||
* c-opts.c (c_common_post_options): Enabled by -Wextra.
|
||||
* flow.c (rest_of_handle_life): Replace Wextra with Wclobbered.
|
||||
* function.c (setjmp_vars_warning): Only warn for Wclobbered.
|
||||
(setjmp_args_warning): Likewise.
|
||||
|
||||
2006-12-22 Kazu Hirata <kazu@codesourcery.com>
|
||||
|
||||
* config/elfos.h, config/spu/spu.c, tree-ssa-operands.h,
|
||||
|
|
|
@ -1025,9 +1025,11 @@ c_common_post_options (const char **pfilename)
|
|||
if (flag_objc_exceptions && !flag_objc_sjlj_exceptions)
|
||||
flag_exceptions = 1;
|
||||
|
||||
/* -Wextra implies -Wempty-body, -Wsign-compare,
|
||||
/* -Wextra implies -Wclobbered, -Wempty-body, -Wsign-compare,
|
||||
-Wmissing-field-initializers and -Woverride-init,
|
||||
but not if explicitly overridden. */
|
||||
if (warn_clobbered == -1)
|
||||
warn_clobbered = extra_warnings;
|
||||
if (warn_empty_body == -1)
|
||||
warn_empty_body = extra_warnings;
|
||||
if (warn_sign_compare == -1)
|
||||
|
|
|
@ -141,6 +141,10 @@ Wchar-subscripts
|
|||
C ObjC C++ ObjC++ Var(warn_char_subscripts)
|
||||
Warn about subscripts whose type is \"char\"
|
||||
|
||||
Wclobbered
|
||||
C ObjC C++ ObjC++ Var(warn_clobbered) Init(-1)
|
||||
Warn about variables that might be changed by \"longjmp\" or \"vfork\"
|
||||
|
||||
Wcomment
|
||||
C ObjC C++ ObjC++
|
||||
Warn about possibly nested block comments, and C++ comments spanning more than one physical line
|
||||
|
|
|
@ -222,7 +222,8 @@ Objective-C and Objective-C++ Dialects}.
|
|||
@xref{Warning Options,,Options to Request or Suppress Warnings}.
|
||||
@gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol
|
||||
-w -Wextra -Wall -Waggregate-return -Walways-true -Wno-attributes @gol
|
||||
-Wc++-compat -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol
|
||||
-Wc++-compat -Wcast-align -Wcast-qual -Wchar-subscripts @gol
|
||||
-Wclobbered -Wcomment @gol
|
||||
-Wconversion -Wno-deprecated-declarations @gol
|
||||
-Wdisabled-optimization -Wno-div-by-zero @gol
|
||||
-Wempty-body -Wno-endif-labels @gol
|
||||
|
@ -2925,6 +2926,7 @@ A pointer is compared against integer zero with @samp{<}, @samp{<=},
|
|||
|
||||
@item
|
||||
A variable might be changed by @samp{longjmp} or @samp{vfork}.
|
||||
This warning can be independently controlled by @option{-Wclobbered}.
|
||||
|
||||
@item
|
||||
Any of several floating-point events that often indicate errors, such as
|
||||
|
@ -3157,6 +3159,11 @@ only if you have been very careful about using @code{const} in
|
|||
declarations and prototypes. Otherwise, it will just be a nuisance;
|
||||
this is why we did not make @option{-Wall} request these warnings.
|
||||
|
||||
@item -Wclobbered
|
||||
@opindex Wclobbered
|
||||
Warn for variables that might be changed by @samp{longjmp} or
|
||||
@samp{vfork}. This warning is also enabled by @option{-Wextra}.
|
||||
|
||||
@item -Wconversion
|
||||
@opindex Wconversion
|
||||
Warn for implicit conversions that may alter a value. This includes
|
||||
|
|
|
@ -4695,7 +4695,7 @@ rest_of_handle_life (void)
|
|||
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE | CLEANUP_LOG_LINKS
|
||||
| (flag_thread_jumps ? CLEANUP_THREADING : 0));
|
||||
|
||||
if (extra_warnings)
|
||||
if (warn_clobbered)
|
||||
{
|
||||
setjmp_vars_warning (DECL_INITIAL (current_function_decl));
|
||||
setjmp_args_warning ();
|
||||
|
|
|
@ -3536,9 +3536,8 @@ setjmp_vars_warning (tree block)
|
|||
&& DECL_RTL_SET_P (decl)
|
||||
&& REG_P (DECL_RTL (decl))
|
||||
&& regno_clobbered_at_setjmp (REGNO (DECL_RTL (decl))))
|
||||
warning (0, "variable %q+D might be clobbered by %<longjmp%>"
|
||||
" or %<vfork%>",
|
||||
decl);
|
||||
warning (OPT_Wclobbered, "variable %q+D might be clobbered by"
|
||||
" %<longjmp%> or %<vfork%>", decl);
|
||||
}
|
||||
|
||||
for (sub = BLOCK_SUBBLOCKS (block); sub; sub = TREE_CHAIN (sub))
|
||||
|
@ -3557,7 +3556,8 @@ setjmp_args_warning (void)
|
|||
if (DECL_RTL (decl) != 0
|
||||
&& REG_P (DECL_RTL (decl))
|
||||
&& regno_clobbered_at_setjmp (REGNO (DECL_RTL (decl))))
|
||||
warning (0, "argument %q+D might be clobbered by %<longjmp%> or %<vfork%>",
|
||||
warning (OPT_Wclobbered,
|
||||
"argument %q+D might be clobbered by %<longjmp%> or %<vfork%>",
|
||||
decl);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2006-12-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR middle-end/7651
|
||||
* gcc.dg/attr-returns_twice-1.c: Replace Wextra with Wclobbered.
|
||||
* gcc.dg/setjmp-1.c: Add explicit Wclobbered.
|
||||
|
||||
2006-12-21 Andrew Pinski <pinskia@gmail.com>
|
||||
|
||||
PR C++/30168
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
|
||||
/* { dg-options "-W" } */
|
||||
/* { dg-options "-Wclobbered" } */
|
||||
|
||||
int newsetjmp(void) __attribute__((returns_twice));
|
||||
void g(int);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Inspired by cse.c:simplify_relational_operation. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -W -Wall" } */
|
||||
/* { dg-options "-O -Wclobbered -Wextra -Wall" } */
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue