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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120151
138bc75d-0d04-0410-961f-
82ee72b054a4
+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,
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)
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
@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
@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
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
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 ();
&& 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))
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);
}
+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
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-W" } */
+/* { dg-options "-Wclobbered" } */
int newsetjmp(void) __attribute__((returns_twice));
void g(int);
Inspired by cse.c:simplify_relational_operation. */
/* { dg-do compile } */
-/* { dg-options "-O -W -Wall" } */
+/* { dg-options "-O -Wclobbered -Wextra -Wall" } */
#include <setjmp.h>