OSDN Git Service

2009-09-24 Steven G. Kargl <kargl@gcc.gnu.org>
authorkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Sep 2009 21:53:36 +0000 (21:53 +0000)
committerkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Sep 2009 21:53:36 +0000 (21:53 +0000)
PR fortran/41459
* gfortran.dg/empty_label.f: New test.
* gfortran.dg/empty_label.f90: Ditto.
* gfortran.dg/warnings_are_errors_1.f: Fix to emit a single warning.

2009-09-24  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/41459
* error.c(gfc_warning_now): Move warnings_are_errors test to
after actual emitting of the warning.
* parse.c (next_free): Improve error locus printing.
(next_fixed): Change gfc_warn to gfc_warning_now, and improve
locus reporting.

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

gcc/fortran/ChangeLog
gcc/fortran/error.c
gcc/fortran/parse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/empty_label.f [new file with mode: 0644]
gcc/testsuite/gfortran.dg/empty_label.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/warnings_are_errors_1.f

index 9c9744b..650adca 100644 (file)
@@ -1,3 +1,13 @@
+2009-09-24  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/41459
+       * error.c(gfc_warning_now): Move warnings_are_errors test to 
+       after actual emitting of the warning.
+       * parse.c (next_free): Improve error locus printing.
+       (next_fixed): Change gfc_warn to gfc_warning_now, and improve
+       locus reporting.
+
 2009-09-16  Michael Matz  <matz@suse.de>
 
        PR fortran/41212
index 9d5453e..88c2883 100644 (file)
@@ -821,14 +821,16 @@ gfc_warning_now (const char *nocmsgid, ...)
   i = buffer_flag;
   buffer_flag = 0;
   warnings++;
-  if (warnings_are_errors)
-    gfc_increment_error_count();
 
   va_start (argp, nocmsgid);
   error_print (_("Warning:"), _(nocmsgid), argp);
   va_end (argp);
 
   error_char ('\0');
+
+  if (warnings_are_errors)
+    gfc_increment_error_count();
+
   buffer_flag = i;
 }
 
index e743989..93a6cfd 100644 (file)
@@ -655,7 +655,7 @@ next_free (void)
          if (gfc_match_eos () == MATCH_YES)
            {
              gfc_warning_now ("Ignoring statement label in empty statement "
-                              "at %C");
+                              "at %L", &label_locus);
              gfc_free_st_label (gfc_statement_label);
              gfc_statement_label = NULL;
              return ST_NONE;
@@ -848,7 +848,8 @@ next_fixed (void)
 
 blank_line:
   if (digit_flag)
-    gfc_warning ("Ignoring statement label in empty statement at %C");
+    gfc_warning_now ("Ignoring statement label in empty statement at %L",
+                    &label_locus);
     
   gfc_current_locus.lb->truncated = 0;
   gfc_advance_line ();
index 2511b4e..c307a0f 100644 (file)
@@ -1,3 +1,10 @@
+2009-09-24  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/41459
+       * gfortran.dg/empty_label.f: New test.
+       * gfortran.dg/empty_label.f90: Ditto.
+       * gfortran.dg/warnings_are_errors_1.f: Fix to emit a single warning. 
+
 2009-09-24  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.dg/torture/builtin-math-7.c: Test complex int division at
diff --git a/gcc/testsuite/gfortran.dg/empty_label.f b/gcc/testsuite/gfortran.dg/empty_label.f
new file mode 100644 (file)
index 0000000..446fe8b
--- /dev/null
@@ -0,0 +1,5 @@
+C { dg-do compile }
+C { dg-options "-Werror -fmax-errors=1" }
+100   ! { dg-warning "empty statement" }
+      end
+C { dg-error "count reached limit" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/gfortran.dg/empty_label.f90 b/gcc/testsuite/gfortran.dg/empty_label.f90
new file mode 100644 (file)
index 0000000..6300d30
--- /dev/null
@@ -0,0 +1,5 @@
+! { dg-do compile }
+! { dg-options "-Werror -fmax-errors=1" }
+100   ! { dg-warning "empty statement" }
+end
+! { dg-error "count reached limit" "" { target *-*-* } 0 }
index 2452b49..3d163bb 100644 (file)
@@ -8,7 +8,7 @@
        integer(kind=1) :: i
        real :: r1, r2(3)
 ! gfc_warning_now:
-0      ! { dg-warning "Zero is not a valid statement label" }
+0      r1 = 0 ! { dg-warning "Zero is not a valid statement label" }
 !
 34 5   i=0 
 ! gfc_notify_std(GFC_STD_F95_DEL):