Commit 88199e7c by Tobias Schlüter Committed by Tobias Schlüter

re PR fortran/16433 (wrong hexadecimal constant warning)

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
parent 6fd21094
...@@ -12,7 +12,11 @@ ...@@ -12,7 +12,11 @@
(gfc_match_return): RETURN in main program is an extension. (gfc_match_return): RETURN in main program is an extension.
(gfc_match_block_data): A space is required before a block data (gfc_match_block_data): A space is required before a block data
name. 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> 2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk>
* f95-lang.c (set_block): Remove. * f95-lang.c (set_block): Remove.
......
...@@ -235,7 +235,7 @@ match_integer_constant (gfc_expr ** result, int signflag) ...@@ -235,7 +235,7 @@ match_integer_constant (gfc_expr ** result, int signflag)
static match static match
match_boz_constant (gfc_expr ** result) match_boz_constant (gfc_expr ** result)
{ {
int radix, delim, length; int radix, delim, length, x_hex;
locus old_loc; locus old_loc;
char *buffer; char *buffer;
gfc_expr *e; gfc_expr *e;
...@@ -244,6 +244,7 @@ match_boz_constant (gfc_expr ** result) ...@@ -244,6 +244,7 @@ match_boz_constant (gfc_expr ** result)
old_loc = gfc_current_locus; old_loc = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
x_hex = 0;
switch (gfc_next_char ()) switch (gfc_next_char ())
{ {
case 'b': case 'b':
...@@ -255,12 +256,7 @@ match_boz_constant (gfc_expr ** result) ...@@ -255,12 +256,7 @@ match_boz_constant (gfc_expr ** result)
rname = "octal"; rname = "octal";
break; break;
case 'x': case 'x':
if (pedantic x_hex = 1;
&& (gfc_notify_std (GFC_STD_GNU, "Extension: Hexadecimal "
"constant at %C uses non-standard syntax.")
== FAILURE))
goto backup;
/* Fall through. */ /* Fall through. */
case 'z': case 'z':
radix = 16; radix = 16;
...@@ -310,6 +306,16 @@ match_boz_constant (gfc_expr ** result) ...@@ -310,6 +306,16 @@ match_boz_constant (gfc_expr ** result)
return MATCH_ERROR; 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; *result = e;
return MATCH_YES; return MATCH_YES;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment