1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00

Parse the C99 "restrict" keyword correctly (but ignore it otherwise).

git-svn-id: svn://svn.cc65.org/cc65/trunk@3706 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2006-02-17 20:19:35 +00:00
parent 32164ea8e5
commit 64921852dd
4 changed files with 14 additions and 4 deletions

View File

@ -104,7 +104,8 @@ enum {
T_QUAL_NONE = 0x0000,
T_QUAL_CONST = 0x1000,
T_QUAL_VOLATILE = 0x2000,
T_MASK_QUAL = 0x3000,
T_QUAL_RESTRICT = 0x4000,
T_MASK_QUAL = 0x7000,
/* Types */
T_CHAR = T_TYPE_CHAR | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_NONE,

View File

@ -103,6 +103,13 @@ static type OptionalQualifiers (type Q)
Q |= T_QUAL_VOLATILE;
break;
case TOK_RESTRICT:
if (Q & T_QUAL_RESTRICT) {
Error ("Duplicate qualifier: `restrict'");
}
Q |= T_QUAL_RESTRICT;
break;
default:
Internal ("Unexpected type qualifier token: %d", CurTok.Tok);

View File

@ -639,7 +639,7 @@ static void Primary (ExprDesc* E)
Error ("Preprocessor expression expected");
ED_MakeConstAbsInt (E, 1);
return;
}
}
switch (CurTok.Tok) {
@ -1628,6 +1628,8 @@ static void hie_internal (const GenDesc* Ops, /* List of generators */
/* All operators that call this function expect an int on the lhs */
if (!IsClassInt (Expr->Type)) {
Error ("Integer expression expected");
/* To avoid further errors, make Expr a valid int expression */
ED_MakeConstAbsInt (Expr, 1);
}
/* Remember the operator token, then skip it */

View File

@ -58,7 +58,6 @@ typedef enum token_t {
TOK_AUTO,
TOK_EXTERN,
TOK_REGISTER,
TOK_RESTRICT,
TOK_STATIC,
TOK_TYPEDEF,
@ -66,7 +65,8 @@ typedef enum token_t {
TOK_FIRST_TYPEQUAL,
TOK_CONST = TOK_FIRST_TYPEQUAL,
TOK_VOLATILE,
TOK_LAST_TYPEQUAL = TOK_VOLATILE,
TOK_RESTRICT,
TOK_LAST_TYPEQUAL = TOK_RESTRICT,
/* Tokens denoting types */
TOK_FIRST_TYPE,