This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: [Patch, fortran] PR24767 -Wno-unused-label does not work properly


On Fri, Oct 13, 2006 at 11:57:42AM +0200, Bernhard Fischer wrote:
>:ADDPATCH fortran:
>
>-Wno-unused-label from common.opt should be used instead of
>-Wno-unused-labels from fortran/lang.opt.
>
>Passing -Wall -Wno-unused-label to gfortran did not suppress the warning
>about an unused label since gfortran crafted it's own flag called
>-W(no-)unused-labels instead of using the commonly used flag in
>singular.
>
>This patch removes the fortran specific flag in favour of using the
>common flag.
>
>I'll try to find the time to regtest this patch during the weekend, but
>i don't believe it can cause any harm (fwiw ;).

Bootstrapped and regtested on hppa-unknown-linux-gnu. Docs generated
with make dvi pdf.
Ok for trunk?
>
>thanks,
>
>fortran/ChangeLog
>
>2006-10-13  Bernhard Fischer  <aldot@gcc.gnu.org>
>
>        PR fortran/24767
>        * lang.opt (Wunused-labels): Remove.
>        * options.c: Remove references to gfc_option.warn_unused_labels.
>        * gfortran.h: Remove variable warn_unused_labels.               
>        * resolve.c (warn_unused_fortran_label) : Use warn_unused_label
>        instead of gfc_option.warn_unused_labels.
>        * invoke.texi: Remove documentation of -Wunused-labels.
>
>testsuite/ChangeLog
>
>2006-10-13  Bernhard Fischer  <aldot@gcc.gnu.org>
>
>        PR fortran/24767
>        * gfortran.dg/label_4.f90: Adjust warning flag.
>

>diff -rup gcc-4.2.before_pr24767/gcc/fortran/gfortran.h gcc-4.2/gcc/fortran/gfortran.h
>--- gcc-4.2.before_pr24767/gcc/fortran/gfortran.h	2006-10-12 18:43:35.000000000 +0200
>+++ gcc-4.2/gcc/fortran/gfortran.h	2006-10-13 11:00:58.000000000 +0200
>@@ -1633,7 +1633,6 @@ typedef struct
>   int warn_surprising;
>   int warn_tabs;
>   int warn_underflow;
>-  int warn_unused_labels;
> 
>   int flag_all_intrinsics;
>   int flag_default_double;
>diff -rup gcc-4.2.before_pr24767/gcc/fortran/invoke.texi gcc-4.2/gcc/fortran/invoke.texi
>--- gcc-4.2.before_pr24767/gcc/fortran/invoke.texi	2006-10-12 18:43:35.000000000 +0200
>+++ gcc-4.2/gcc/fortran/invoke.texi	2006-10-13 11:12:23.000000000 +0200
>@@ -130,7 +130,7 @@ by type.  Explanations are in the follow
> -fsyntax-only  -pedantic  -pedantic-errors @gol
> -w  -Wall  -Waliasing -Wampersand -Wconversion -Wimplicit-interface @gol
> -Wtabs -Wnonstd-intrinsics -Wsurprising -Wunderflow @gol
>--Wunused-labels -Wline-truncation -W}
>+-Wline-truncation -W}
> 
> @item Debugging Options
> @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
>@@ -403,7 +403,7 @@ Inhibit all warning messages.
> @cindex warnings, all
> Enables commonly used warning options pertaining to usage that
> we recommend avoiding and that we believe are easy to avoid.
>-This currently includes @option{-Wunused-labels}, @option{-Waliasing},
>+This currently includes @option{-Waliasing},
> @option{-Wampersand}, @option{-Wsurprising}, @option{-Wnonstd-intrinsic},
> @option{-Wno-tabs}, and @option{-Wline-truncation}.
> 
>@@ -501,14 +501,6 @@ Produce a warning when numerical constan
> encountered, which yield an UNDERFLOW during compilation.
> 
> 
>-@cindex -Wunused-labels option
>-@cindex options, -Wunused-labels
>-@item -Wunused-labels
>-@cindex unused labels
>-@cindex labels, unused
>-Warn whenever a label is defined but never referenced.
>-
>-
> @cindex -Werror
> @cindex options, -Werror
> @item -Werror
>diff -rup gcc-4.2.before_pr24767/gcc/fortran/lang.opt gcc-4.2/gcc/fortran/lang.opt
>--- gcc-4.2.before_pr24767/gcc/fortran/lang.opt	2006-06-19 10:17:48.000000000 +0200
>+++ gcc-4.2/gcc/fortran/lang.opt	2006-10-13 09:21:04.000000000 +0200
>@@ -73,10 +73,6 @@ Wunderflow
> Fortran
> Warn about underflow of numerical constant expressions
> 
>-Wunused-labels
>-Fortran
>-Warn when a label is unused
>-
> fall-intrinsics
> Fortran RejectNegative
> All intrinsics procedures are available regardless of selected standard
>diff -rup gcc-4.2.before_pr24767/gcc/fortran/options.c gcc-4.2/gcc/fortran/options.c
>--- gcc-4.2.before_pr24767/gcc/fortran/options.c	2006-10-12 18:43:36.000000000 +0200
>+++ gcc-4.2/gcc/fortran/options.c	2006-10-13 09:24:00.000000000 +0200
>@@ -61,7 +61,6 @@ gfc_init_options (unsigned int argc ATTR
>   gfc_option.warn_surprising = 0;
>   gfc_option.warn_tabs = 1;
>   gfc_option.warn_underflow = 1;
>-  gfc_option.warn_unused_labels = 0;
> 
>   gfc_option.flag_all_intrinsics = 0;
>   gfc_option.flag_default_double = 0;
>@@ -303,8 +302,7 @@ set_Wall (void)
>   gfc_option.warn_surprising = 1;
>   gfc_option.warn_tabs = 0;
>   gfc_option.warn_underflow = 1;
>-  gfc_option.warn_unused_labels = 1;
>- 
>+
>   set_Wunused (1);
>   warn_return_type = 1;
>   warn_switch = 1;
>@@ -428,10 +426,6 @@ gfc_handle_option (size_t scode, const c
>       gfc_option.warn_underflow = value;
>       break;
> 
>-    case OPT_Wunused_labels:
>-      gfc_option.warn_unused_labels = value;
>-      break;
>-
>     case OPT_fall_intrinsics:
>       gfc_option.flag_all_intrinsics = 1;
>       break;
>diff -rup gcc-4.2.before_pr24767/gcc/fortran/resolve.c gcc-4.2/gcc/fortran/resolve.c
>--- gcc-4.2.before_pr24767/gcc/fortran/resolve.c	2006-10-12 18:43:35.000000000 +0200
>+++ gcc-4.2/gcc/fortran/resolve.c	2006-10-13 11:03:20.000000000 +0200
>@@ -6877,7 +6877,7 @@ resolve_types (gfc_namespace * ns)
>     resolve_equivalence (eq);
> 
>   /* Warn about unused labels.  */
>-  if (gfc_option.warn_unused_labels)
>+  if (warn_unused_label)
>     warn_unused_fortran_label (ns->st_labels);
> 
>   gfc_resolve_uops (ns->uop_root);
>diff -rup gcc-4.2.before_pr24767/gcc/testsuite/gfortran.dg/label_4.f90 gcc-4.2/gcc/testsuite/gfortran.dg/label_4.f90
>--- gcc-4.2.before_pr24767/gcc/testsuite/gfortran.dg/label_4.f90	2006-02-15 09:25:01.000000000 +0100
>+++ gcc-4.2/gcc/testsuite/gfortran.dg/label_4.f90	2006-10-13 11:05:49.000000000 +0200
>@@ -1,5 +1,5 @@
> ! { dg-do compile }
>-! { dg-options "-Wunused-labels" }
>+! { dg-options "-Wunused-label" }
> ! PR 26277
> ! We used to give an incorect warning about label 99 not being referenced
>   open(unit=12,err=99)


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