re PR fortran/16433 (wrong hexadecimal constant warning)
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Sun, 11 Jul 2004 15:06:42 +0000 (17:06 +0200)
committerTobias Schlüter <tobi@gcc.gnu.org>
Sun, 11 Jul 2004 15:06:42 +0000 (17:06 +0200)
PR fortran/16433
* primary.c (match_boz_constant): Call gfc_notify_std only if
we actually have a non-standard boz-literal-constant.

From-SVN: r84514

gcc/fortran/ChangeLog
gcc/fortran/primary.c

index a787c9dcbeeee24730b851e39e9775ac17caa083..966221c932af572d21c4658132898728e38999f6 100644 (file)
        (gfc_match_return): RETURN in main program is an extension.
        (gfc_match_block_data): A space is required before a block data
        name.
-       
+
+       PR fortran/16433
+       * primary.c (match_boz_constant): Call gfc_notify_std only if
+       we actually have a non-standard boz-literal-constant.
+
 2004-07-11  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        * f95-lang.c (set_block): Remove.
index 35931557d84b1fe6545e41a29106b9a2ec1c1c29..d054bfdb55bfac64b35517f35093fcce7fe1d6dd 100644 (file)
@@ -235,7 +235,7 @@ match_integer_constant (gfc_expr ** result, int signflag)
 static match
 match_boz_constant (gfc_expr ** result)
 {
-  int radix, delim, length;
+  int radix, delim, length, x_hex;
   locus old_loc;
   char *buffer;
   gfc_expr *e;
@@ -244,6 +244,7 @@ match_boz_constant (gfc_expr ** result)
   old_loc = gfc_current_locus;
   gfc_gobble_whitespace ();
 
+  x_hex = 0;
   switch (gfc_next_char ())
     {
     case 'b':
@@ -255,12 +256,7 @@ match_boz_constant (gfc_expr ** result)
       rname = "octal";
       break;
     case 'x':
-      if (pedantic
-         && (gfc_notify_std (GFC_STD_GNU, "Extension: Hexadecimal "
-                            "constant at %C uses non-standard syntax.")
-             == FAILURE))
-       goto backup;
-
+      x_hex = 1;
       /* Fall through.  */
     case 'z':
       radix = 16;
@@ -310,6 +306,16 @@ match_boz_constant (gfc_expr ** result)
       return MATCH_ERROR;
     }
 
+  if (x_hex
+      && pedantic
+      && (gfc_notify_std (GFC_STD_GNU, "Extension: Hexadecimal "
+                         "constant at %C uses non-standard syntax.")
+         == FAILURE))
+    {
+      gfc_free_expr (e);
+      return MATCH_ERROR;
+    }
+
   *result = e;
   return MATCH_YES;