Commit 74657812 by Jerry DeLisle

re PR fortran/37988 (Edit descriptor checking (compile time) for "<Holerith>T)")

2008-11-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/37988
	* io.c (enum format_token): For readability replace FMT_POS with FMT_T,
	FMT_TL, and FMT_TR.  (format_lex): Use new enumerators. (check_format):
	Add check for missing positive integer.

From-SVN: r141879
parent e344d690
2008-11-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/37988
* io.c (enum format_token): For readability replace FMT_POS with FMT_T,
FMT_TL, and FMT_TR. (format_lex): Use new enumerators. (check_format):
Add check for missing positive integer.
2008-10-14 Paul Thomas <pault@gcc.gnu.org> 2008-10-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38033 PR fortran/38033
......
...@@ -107,10 +107,10 @@ static gfc_dt *current_dt; ...@@ -107,10 +107,10 @@ static gfc_dt *current_dt;
typedef enum typedef enum
{ {
FMT_NONE, FMT_UNKNOWN, FMT_SIGNED_INT, FMT_ZERO, FMT_POSINT, FMT_PERIOD, FMT_NONE, FMT_UNKNOWN, FMT_SIGNED_INT, FMT_ZERO, FMT_POSINT, FMT_PERIOD,
FMT_COMMA, FMT_COLON, FMT_SLASH, FMT_DOLLAR, FMT_POS, FMT_LPAREN, FMT_COMMA, FMT_COLON, FMT_SLASH, FMT_DOLLAR, FMT_LPAREN,
FMT_RPAREN, FMT_X, FMT_SIGN, FMT_BLANK, FMT_CHAR, FMT_P, FMT_IBOZ, FMT_F, FMT_RPAREN, FMT_X, FMT_SIGN, FMT_BLANK, FMT_CHAR, FMT_P, FMT_IBOZ, FMT_F,
FMT_E, FMT_EXT, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_ERROR, FMT_DC, FMT_E, FMT_EXT, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_ERROR, FMT_DC,
FMT_DP FMT_DP, FMT_T, FMT_TR, FMT_TL
} }
format_token; format_token;
...@@ -314,10 +314,18 @@ format_lex (void) ...@@ -314,10 +314,18 @@ format_lex (void)
case 'T': case 'T':
c = next_char_not_space (&error); c = next_char_not_space (&error);
if (c != 'L' && c != 'R') switch (c)
unget_char (); {
case 'L':
token = FMT_POS; token = FMT_TL;
break;
case 'R':
token = FMT_TR;
break;
default:
token = FMT_T;
unget_char ();
}
break; break;
case '(': case '(':
...@@ -596,7 +604,9 @@ format_item_1: ...@@ -596,7 +604,9 @@ format_item_1:
goto finished; goto finished;
case FMT_POS: case FMT_T:
case FMT_TL:
case FMT_TR:
case FMT_IBOZ: case FMT_IBOZ:
case FMT_F: case FMT_F:
case FMT_E: case FMT_E:
...@@ -646,7 +656,17 @@ data_desc: ...@@ -646,7 +656,17 @@ data_desc:
goto optional_comma; goto optional_comma;
case FMT_POS: case FMT_T:
case FMT_TL:
case FMT_TR:
t = format_lex ();
if (t != FMT_POSINT)
{
error = _("Positive width required with T descriptor");
goto syntax;
}
break;
case FMT_L: case FMT_L:
t = format_lex (); t = format_lex ();
if (t == FMT_ERROR) if (t == FMT_ERROR)
......
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