]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/52101 (Obsolescence warning for non-obs. feature character name*length)
authorTobias Burnus <burnus@net-b.de>
Tue, 17 Jul 2012 09:40:12 +0000 (11:40 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Tue, 17 Jul 2012 09:40:12 +0000 (11:40 +0200)
2012-07-17  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52101
        * decl.c (match_char_length): Extra argument, show obsolenscent
        warning only if *length is used after the typename.
        (variable_decl, gfc_match_char_spec): Update call

2012-07-17  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52101
        * gfortran.dg/oldstyle_4.f90: New.

From-SVN: r189565

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/oldstyle_4.f90 [new file with mode: 0644]

index fede706c0c65f9486c81b16ac173fb130a3963da..9042014780296a1fb005101a4c1e99326bd439c8 100644 (file)
@@ -1,3 +1,10 @@
+2012-07-17  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/52101
+       * decl.c (match_char_length): Extra argument, show obsolenscent
+       warning only if *length is used after the typename.
+       (variable_decl, gfc_match_char_spec): Update call
+
 2012-07-17  Tobias Burnus  <burnus@net-b.de>
            Steven G. Kargl  <kargl@gcc.gnu.org>
 
index 9bd3dc3a688a769b701d60153c2ff2884e976721..89d501cdc1832796ea0e56c0d48276f1bfe43102 100644 (file)
@@ -723,7 +723,7 @@ syntax:
    char_len_param_value in parenthesis.  */
 
 static match
-match_char_length (gfc_expr **expr, bool *deferred)
+match_char_length (gfc_expr **expr, bool *deferred, bool obsolenscent_check)
 {
   int length;
   match m;
@@ -739,8 +739,9 @@ match_char_length (gfc_expr **expr, bool *deferred)
 
   if (m == MATCH_YES)
     {
-      if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: "
-                         "Old-style character length at %C") == FAILURE)
+      if (obsolenscent_check
+         && gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: "
+                            "Old-style character length at %C") == FAILURE)
        return MATCH_ERROR;
       *expr = gfc_get_int_expr (gfc_default_integer_kind, NULL, length);
       return m;
@@ -1849,7 +1850,7 @@ variable_decl (int elem)
 
   if (current_ts.type == BT_CHARACTER)
     {
-      switch (match_char_length (&char_len, &cl_deferred))
+      switch (match_char_length (&char_len, &cl_deferred, false))
        {
        case MATCH_YES:
          cl = gfc_new_charlen (gfc_current_ns, NULL);
@@ -2411,7 +2412,7 @@ gfc_match_char_spec (gfc_typespec *ts)
   /* Try the old-style specification first.  */
   old_char_selector = 0;
 
-  m = match_char_length (&len, &deferred);
+  m = match_char_length (&len, &deferred, true);
   if (m != MATCH_NO)
     {
       if (m == MATCH_YES)
index b978c907e0402da0ff365cc3a25465977c7d744a..56743bd137b38c9dd118db233e95774ef6875917 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-17  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/52101
+       * gfortran.dg/oldstyle_4.f90: New.
+
 2012-07-17  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/49265
diff --git a/gcc/testsuite/gfortran.dg/oldstyle_4.f90 b/gcc/testsuite/gfortran.dg/oldstyle_4.f90
new file mode 100644 (file)
index 0000000..d40abeb
--- /dev/null
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+!
+! PR fortran/52101
+!
+! Contributed by John Harper
+!
+program foo
+   character*10 s    ! { dg-warning "Obsolescent feature: Old-style character length" }
+   character    t*10 ! Still okay
+   s = 'foo'
+   t = 'bar'
+end program foo