summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-05 12:30:30 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-05 12:30:30 +0000
commitcc029bec00c7e130c9d46188e9b8c12809fb2a7b (patch)
tree589de603d5bb2de5f913adb4dcd7e403d6b4dc07 /gcc
parent54e1206558f182f5935cb32a36a8d2dc448acd40 (diff)
downloadgcc-cc029bec00c7e130c9d46188e9b8c12809fb2a7b.tar.gz
2010-01-05 Eric Fisher <joefoxreal@gmail.com>
* doc/invoke.texi: Remove the documentation about option -Wunreachable-code. * common.opt (Wunreachable-code): Preserved for backward compatibility. * tree-cfg.c: Remove the implementation of -Wunreachable-code. * opts.c (common_handle_option): Add OPT_Wunreachable_code to the backward compatibility flag section. * gcc.dg/pr12603.c: Remove -Wunreachable-code from dg-options. * gcc.dg/Wunreachable-1.c: Remove the testcase of -Wunreachable-code. * gcc.dg/Wunreachable-2.c: Likewise. * gcc.dg/Wunreachable-3.c: Likewise. * gcc.dg/Wunreachable-4.c: Likewise. * gcc.dg/Wunreachable-5.c: Likewise. * gcc.dg/Wunreachable-6.c: Likewise. * gcc.dg/Wunreachable-7.c: Likewise. * gcc.dg/Wunreachable-8.c: Likewise. * gcc.dg/20041231-1.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155645 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/common.opt4
-rw-r--r--gcc/doc/invoke.texi25
-rw-r--r--gcc/opts.c1
-rw-r--r--gcc/testsuite/ChangeLog14
-rw-r--r--gcc/testsuite/gcc.dg/20041231-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/Wunreachable-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/Wunreachable-2.c19
-rw-r--r--gcc/testsuite/gcc.dg/Wunreachable-3.c17
-rw-r--r--gcc/testsuite/gcc.dg/Wunreachable-4.c12
-rw-r--r--gcc/testsuite/gcc.dg/Wunreachable-5.c17
-rw-r--r--gcc/testsuite/gcc.dg/Wunreachable-6.c21
-rw-r--r--gcc/testsuite/gcc.dg/Wunreachable-7.c21
-rw-r--r--gcc/testsuite/gcc.dg/Wunreachable-8.c20
-rw-r--r--gcc/testsuite/gcc.dg/pr12603.c2
-rw-r--r--gcc/tree-cfg.c16
16 files changed, 29 insertions, 209 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9f8770fcaa0..db624b919e9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2010-01-05 Eric Fisher <joefoxreal@gmail.com>
+
+ * doc/invoke.texi: Remove the documentation about option
+ -Wunreachable-code.
+ * common.opt (Wunreachable-code): Preserved for backward
+ compatibility.
+ * tree-cfg.c: Remove the implementation of -Wunreachable-code.
+ * opts.c (common_handle_option): Add OPT_Wunreachable_code to
+ the backward compatibility flag section.
+
2010-01-05 Richard Guenther <rguenther@suse.de>
* tree-ssa-pre.c (bitmap_value_insert_into_set): Optimize.
diff --git a/gcc/common.opt b/gcc/common.opt
index ac942ee6a1f..8e8ed762005 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -201,8 +201,8 @@ Common Var(warn_uninitialized) Init(-1) Warning
Warn about uninitialized automatic variables
Wunreachable-code
-Common Var(warn_notreached) Warning
-Warn about code that will never be executed
+Common
+Does nothing. Preserved for backward compatibility.
Wunused
Common Var(warn_unused) Init(0) Warning
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f7d3bc81254..5022c4a80db 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -259,7 +259,7 @@ Objective-C and Objective-C++ Dialects}.
-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
-Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
-Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol
--Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol
+-Wunknown-pragmas -Wno-pragmas @gol
-Wunsuffixed-float-constants -Wunused -Wunused-function @gol
-Wunused-label -Wunused-parameter -Wno-unused-result -Wunused-value -Wunused-variable @gol
-Wvariadic-macros -Wvla @gol
@@ -4192,29 +4192,6 @@ cases where multiple declaration is valid and changes nothing.
@opindex Wno-nested-externs
Warn if an @code{extern} declaration is encountered within a function.
-@item -Wunreachable-code
-@opindex Wunreachable-code
-@opindex Wno-unreachable-code
-Warn if the compiler detects that code will never be executed.
-
-This option is intended to warn when the compiler detects that at
-least a whole line of source code will never be executed, because
-some condition is never satisfied or because it is after a
-procedure that never returns.
-
-It is possible for this option to produce a warning even though there
-are circumstances under which part of the affected line can be executed,
-so care should be taken when removing apparently-unreachable code.
-
-For instance, when a function is inlined, a warning may mean that the
-line is unreachable in only one inlined copy of the function.
-
-This option is not made part of @option{-Wall} because in a debugging
-version of a program there is often substantial code which checks
-correct functioning of the program and is, hopefully, unreachable
-because the program does work. Another common use of unreachable
-code is to provide behavior which is selectable at compile-time.
-
@item -Winline
@opindex Winline
@opindex Wno-inline
diff --git a/gcc/opts.c b/gcc/opts.c
index 4ba0d7fd0bf..501deae6ea7 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2131,6 +2131,7 @@ common_handle_option (size_t scode, const char *arg, int value,
case OPT_fforce_addr:
case OPT_ftree_salias:
case OPT_ftree_store_ccp:
+ case OPT_Wunreachable_code:
/* These are no-ops, preserved for backward compatibility. */
break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aea6aa18026..42eb680f7ef 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-05 Eric Fisher <joefoxreal@gmail.com>
+
+ * gcc.dg/pr12603.c: Remove -Wunreachable-code from dg-options.
+ * gcc.dg/Wunreachable-1.c: Remove the testcase of
+ -Wunreachable-code.
+ * gcc.dg/Wunreachable-2.c: Likewise.
+ * gcc.dg/Wunreachable-3.c: Likewise.
+ * gcc.dg/Wunreachable-4.c: Likewise.
+ * gcc.dg/Wunreachable-5.c: Likewise.
+ * gcc.dg/Wunreachable-6.c: Likewise.
+ * gcc.dg/Wunreachable-7.c: Likewise.
+ * gcc.dg/Wunreachable-8.c: Likewise.
+ * gcc.dg/20041231-1.c: Likewise.
+
2010-01-05 Jakub Jelinek <jakub@redhat.com>
PR other/42611
diff --git a/gcc/testsuite/gcc.dg/20041231-1.c b/gcc/testsuite/gcc.dg/20041231-1.c
deleted file mode 100644
index 37c9fe04a1f..00000000000
--- a/gcc/testsuite/gcc.dg/20041231-1.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* PR17544 Incorrect -Wunreachable-code warning
- Origin: Giovanni Bajo
-
- In C99 we append a "return 0;" when finishing a function, but it was
- not given a source location. The gimplifier thinks a return statement
- needs a locus so it would add one, making the compiler generated code
- visible to the unreachable code warning. */
-
-/* { dg-do compile } */
-/* { dg-options "-std=c99 -O -Wunreachable-code" } */
-
-int main (void) // 1
-{ // 2
- return 0; // 3
-} // 4
diff --git a/gcc/testsuite/gcc.dg/Wunreachable-1.c b/gcc/testsuite/gcc.dg/Wunreachable-1.c
deleted file mode 100644
index d6d59b481aa..00000000000
--- a/gcc/testsuite/gcc.dg/Wunreachable-1.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wunreachable-code" } */
-
-extern void foo (void);
-extern void baz (void);
-
-void bar (int i)
-{
- if (i < 2)
- {
- baz ();
- return;
- }
- else
- {
- if (i >= 4 && i <= 5)
- foo ();
- return;
- }
-
- baz (); /* { dg-warning "will never be executed" "" } */
- baz ();
- baz ();
-}
diff --git a/gcc/testsuite/gcc.dg/Wunreachable-2.c b/gcc/testsuite/gcc.dg/Wunreachable-2.c
deleted file mode 100644
index 55a8f9cca01..00000000000
--- a/gcc/testsuite/gcc.dg/Wunreachable-2.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wunreachable-code" } */
-
-extern int foo (const char *);
-extern void baz (void);
-const char *a[] = { "one", "two" };
-
-void bar (void)
-{
- int i;
-
- for (i = 0; i < 2; i++) /* { dg-bogus "will never be executed" "" { xfail *-*-* } } */
- if (! foo (a[i])) /* { dg-bogus "will never be executed" "" { xfail *-*-* } } */
- return;
-
- baz (); /* { dg-bogus "will never be executed" } */
- baz ();
- baz ();
-}
diff --git a/gcc/testsuite/gcc.dg/Wunreachable-3.c b/gcc/testsuite/gcc.dg/Wunreachable-3.c
deleted file mode 100644
index 966d89e3abc..00000000000
--- a/gcc/testsuite/gcc.dg/Wunreachable-3.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* PR c/10175 */
-/* { dg-do compile } */
-/* { dg-options "-Wunreachable-code" } */
-
-int i,j;
-int main(void)
-{
- if (0) {
- i = 0; /* { dg-warning "will never be executed" "" } */
- j = 0;
- } else {
- i = 1;
- j = 1;
- }
-
- return 0;
-}
diff --git a/gcc/testsuite/gcc.dg/Wunreachable-4.c b/gcc/testsuite/gcc.dg/Wunreachable-4.c
deleted file mode 100644
index 38ae6f808c9..00000000000
--- a/gcc/testsuite/gcc.dg/Wunreachable-4.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* PR middle-end/10336 */
-/* { dg-options "-Wunreachable-code" } */
-
-void foo(int i)
-{
- switch(i) {
- case 0:
- break;
- case 1:
- break;
- }
-}
diff --git a/gcc/testsuite/gcc.dg/Wunreachable-5.c b/gcc/testsuite/gcc.dg/Wunreachable-5.c
deleted file mode 100644
index 11dc3204da1..00000000000
--- a/gcc/testsuite/gcc.dg/Wunreachable-5.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* PR c/10175 */
-
-/* { dg-do compile } */
-/* { dg-options "-Wunreachable-code" } */
-
-int value;
-
-int main(void)
-{
- if (0)
- value = 0; /* { dg-warning "will never be executed" "" } */
- else
- value = 1;
-
- return 0;
-}
-
diff --git a/gcc/testsuite/gcc.dg/Wunreachable-6.c b/gcc/testsuite/gcc.dg/Wunreachable-6.c
deleted file mode 100644
index 6aac7aab205..00000000000
--- a/gcc/testsuite/gcc.dg/Wunreachable-6.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* PR c/11370 */
-/* { dg-do compile } */
-/* { dg-options "-Wunreachable-code" } */
-
-extern int printf (const char *, ...);
-extern void exit (int);
-
-int main(int argc, char *argv[])
-{
- if (argc != 1)
- exit(1);
-
- {
- int ix; /* { dg-bogus "will never be executed" } */
- ix = printf("hello\n");
- printf("%d\n", ix);
- }
-
- return 0;
-}
-
diff --git a/gcc/testsuite/gcc.dg/Wunreachable-7.c b/gcc/testsuite/gcc.dg/Wunreachable-7.c
deleted file mode 100644
index 9a4d411be22..00000000000
--- a/gcc/testsuite/gcc.dg/Wunreachable-7.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* PR c/11370 */
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wunreachable-code" } */
-
-extern int printf (const char *, ...);
-extern void exit (int);
-
-int main(int argc, char *argv[])
-{
- if (argc != 1)
- exit(1);
-
- {
- int ix; /* { dg-bogus "will never be executed" } */
- ix = printf("hello\n");
- printf("%d\n", ix);
- }
-
- return 0;
-}
-
diff --git a/gcc/testsuite/gcc.dg/Wunreachable-8.c b/gcc/testsuite/gcc.dg/Wunreachable-8.c
deleted file mode 100644
index 1a13d64243e..00000000000
--- a/gcc/testsuite/gcc.dg/Wunreachable-8.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wunreachable-code" } */
-float Factorial(float X)
-{
- float val = 1.0;
- int k,j;
- for (k=1; k < 5; k++) /* { dg-bogus "will never be executed" "" { xfail *-*-* } } */
- {
- val += 1.0; /* { dg-bogus "will never be executed" "" { xfail *-*-* } } */
- }
- return (val); /* { dg-bogus "will never be executed" } */
-}
-
-int main (void)
-{
- float result;
- result=Factorial(2.1);
- return (0);
-}
-
diff --git a/gcc/testsuite/gcc.dg/pr12603.c b/gcc/testsuite/gcc.dg/pr12603.c
index d0a4835cb1e..f7caef28416 100644
--- a/gcc/testsuite/gcc.dg/pr12603.c
+++ b/gcc/testsuite/gcc.dg/pr12603.c
@@ -1,6 +1,6 @@
/* PR 12603: No return statement warning on function that never returns with -O3. */
/* { dg-do compile } */
-/* { dg-options "-O3 -Wall -Wextra -Wreturn-type -Wunreachable-code" } */
+/* { dg-options "-O3 -Wall -Wextra -Wreturn-type" } */
int
this_function_never_returns ()
{
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 3a086898147..2eb3cd2d79c 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1760,7 +1760,6 @@ static void
remove_bb (basic_block bb)
{
gimple_stmt_iterator i;
- source_location loc = UNKNOWN_LOCATION;
if (dump_file)
{
@@ -1830,24 +1829,9 @@ remove_bb (basic_block bb)
i = gsi_last_bb (bb);
else
gsi_prev (&i);
-
- /* Don't warn for removed gotos. Gotos are often removed due to
- jump threading, thus resulting in bogus warnings. Not great,
- since this way we lose warnings for gotos in the original
- program that are indeed unreachable. */
- if (gimple_code (stmt) != GIMPLE_GOTO
- && gimple_has_location (stmt))
- loc = gimple_location (stmt);
}
}
- /* If requested, give a warning that the first statement in the
- block is unreachable. We walk statements backwards in the
- loop above, so the last statement we process is the first statement
- in the block. */
- if (loc > BUILTINS_LOCATION && LOCATION_LINE (loc) > 0)
- warning_at (loc, OPT_Wunreachable_code, "will never be executed");
-
remove_phi_nodes_and_edges_for_unreachable_block (bb);
bb->il.gimple = NULL;
}