This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran + C testsuite, 4.2] Accept -Wno-all (PR 30437)


This is a backport of a patch by Manuel Lopez-Ibanez, which fixes Fortran's only 4.2 regression, PR 30437. Currently regtesting on i686-pc-linux-gnu. Ok to commit to 4.2, assuming it passes?

fortran/Changelog ----------------------------------------------
2007-03-05  Brooks Moses  <brooks.moses@codesourcery.com>

	PR fortran/30437
	Backport from trunk:
	2007-01-25  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
	* lang.opt (Wall): Remove RejectNegative.
	* options.c (gfc_handle_option): Wall can be disabled.
	(set_Wall): Add a parameter for disabling Wall.

testsuite/Changelog --------------------------------------------
2007-03-05  Brooks Moses  <brooks.moses@codesourcery.com>

	PR fortran/30437
	Backport from trunk:
	2007-01-25  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
	* gcc.dg/Wall.c: New.
	* gcc.dg/Wno-all.c: New.
	* gfortran.dg/Wall.f90: New.
	* gfortran.dg/Wno-all.f90: New.

----------------------------------------------------------------

- Brooks
! 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

Index: lang.opt
===================================================================
--- lang.opt	(revision 122539)
+++ lang.opt	(working copy)
@@ -34,7 +34,7 @@
 -J<directory>	Put MODULE files in 'directory'
 
 Wall
-Fortran RejectNegative
+Fortran
 ; Documented in C
 
 Waliasing
Index: options.c
===================================================================
--- options.c	(revision 122539)
+++ options.c	(working copy)
@@ -308,27 +308,27 @@
 /* Set the options for -Wall.  */
 
 static void
-set_Wall (void)
+set_Wall (int setting)
 {
+  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;
 
-  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 (setting);
+  warn_return_type = setting;
+  warn_switch = setting;
 
-  set_Wunused (1);
-  warn_return_type = 1;
-  warn_switch = 1;
-
   /* 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;
 }
 
@@ -410,7 +410,7 @@
       break;
 
     case OPT_Wall:
-      set_Wall ();
+      set_Wall (value);
       break;
 
     case OPT_Waliasing:
/* 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" } */
}
! { 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

/* 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" } */
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]