OSDN Git Service

2007-01-25 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 Jan 2007 21:15:34 +0000 (21:15 +0000)
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 Jan 2007 21:15:34 +0000 (21:15 +0000)
PR fortran/30437
fortran/
* lang.opt (Wall): Remove RejectNegative.
* options.c (gfc_handle_option): Wall can be disabled.
(set_Wall): Add a parameter for disabling Wall.
testsuite/
* gcc.dg/Wall.c: New.
* gcc.dg/Wno-all.c: New.
* gfortran.dg/Wall.f90: New.
* gfortran.dg/Wno-all.f90: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121186 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/lang.opt
gcc/fortran/options.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wall.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wno-all.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/Wall.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/Wno-all.f90 [new file with mode: 0644]

index 2659bd4..fe816b7 100644 (file)
@@ -1,3 +1,10 @@
+2007-01-25  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+       PR fortran/30437
+       * lang.opt (Wall): Remove RejectNegative.
+       * options.c (gfc_handle_option): Wall can be disabled.
+       (set_Wall): Add a parameter for disabling Wall.
+       
 2007-01-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/30532
index 7d413ff..60806c5 100644 (file)
@@ -34,7 +34,7 @@ Fortran Joined
 -J<directory>  Put MODULE files in 'directory'
 
 Wall
-Fortran RejectNegative
+Fortran
 ; Documented in C
 
 Waliasing
index e3879f0..056ba33 100644 (file)
@@ -298,26 +298,27 @@ gfc_post_options (const char **pfilename)
 /* Set the options for -Wall.  */
 
 static void
-set_Wall (void)
+set_Wall (int setting)
 {
-  gfc_option.warn_aliasing = 1;
-  gfc_option.warn_ampersand = 1;
-  gfc_option.warn_line_truncation = 1;
-  gfc_option.warn_nonstd_intrinsics = 1;
-  gfc_option.warn_surprising = 1;
-  gfc_option.warn_tabs = 0;
-  gfc_option.warn_underflow = 1;
-  gfc_option.warn_character_truncation = 1;
-
-  set_Wunused (1);
-  warn_return_type = 1;
-  warn_switch = 1;
+  gfc_option.warn_aliasing = setting;
+  gfc_option.warn_ampersand = setting;
+  gfc_option.warn_line_truncation = setting;
+  gfc_option.warn_nonstd_intrinsics = setting;
+  gfc_option.warn_surprising = setting;
+  gfc_option.warn_tabs = !setting;
+  gfc_option.warn_underflow = setting;
+  gfc_option.warn_character_truncation = setting;
+
+  set_Wunused (setting);
+  warn_return_type = setting;
+  warn_switch = setting;
 
   /* We save the value of warn_uninitialized, since if they put
      -Wuninitialized on the command line, we need to generate a
      warning about not using it without also specifying -O.  */
-
-  if (warn_uninitialized != 1)
+  if (setting == 0)
+    warn_uninitialized = 0;
+  else if (warn_uninitialized != 1)
     warn_uninitialized = 2;
 }
 
@@ -404,7 +405,7 @@ gfc_handle_option (size_t scode, const char *arg, int value)
       break;
 
     case OPT_Wall:
-      set_Wall ();
+      set_Wall (value);
       break;
 
     case OPT_Waliasing:
index afbd22a..d2473a8 100644 (file)
@@ -1,3 +1,11 @@
+2007-01-25  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+       PR fortran/30437
+       * gcc.dg/Wall.c: New.
+       * gcc.dg/Wno-all.c: New.
+       * gfortran.dg/Wall.f90: New.
+       * gfortran.dg/Wno-all.f90: New.
+       
 2007-01-24  Geoffrey Keating  <geoffk@apple.com>
 
        * gcc.target/powerpc/darwin-ehreturn-1.c: New.
diff --git a/gcc/testsuite/gcc.dg/Wall.c b/gcc/testsuite/gcc.dg/Wall.c
new file mode 100644 (file)
index 0000000..86a359b
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR 30437: Test -Wall 
+   Don't change this without changing Wno-all.c as well.  */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+void foo()
+{
+  int a;
+  5 * (a == 1) | (a == 2);  /* { dg-warning "no effect" "no effect" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Wno-all.c b/gcc/testsuite/gcc.dg/Wno-all.c
new file mode 100644 (file)
index 0000000..3275eb6
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR 30437: Test negative of -Wall
+   Don't change this without changing Wall.c as well.  */
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wno-all" } */
+
+void foo()
+{
+  int a;
+  5 * (a == 1) | (a == 2);  /* { dg-bogus "no effect" "no effect" } */
+}
+
diff --git a/gcc/testsuite/gfortran.dg/Wall.f90 b/gcc/testsuite/gfortran.dg/Wall.f90
new file mode 100644 (file)
index 0000000..a11c4b7
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do run }
+! { dg-options -Wall }
+! PR 30437  Test for Wall
+program main
+  character (len=40) &
+  c
+  c = "Hello, &
+         world!" ! { dg-warning "Warning: Missing '&' in continued character constant" }
+  if (c.ne.&
+                                   "Hello, world!")&
+                               call abort();end program main
+
diff --git a/gcc/testsuite/gfortran.dg/Wno-all.f90 b/gcc/testsuite/gfortran.dg/Wno-all.f90
new file mode 100644 (file)
index 0000000..550c7e4
--- /dev/null
@@ -0,0 +1,12 @@
+! PR 30437  Test for negative Wall
+! { dg-do run }
+! { dg-options "-Wall -Wno-all" }
+program main
+  character (len=40) &
+  c
+  c = "Hello, &
+         world!" ! { dg-bogus "Warning: Missing '&' in continued character constant" }
+  if (c.ne.&
+                                   "Hello, world!")&
+                               call abort();end program main
+