1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-01 08:29:37 +00:00

Allow type qualifiers before a storage class spec.

git-svn-id: svn://svn.cc65.org/cc65/trunk@3705 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2006-02-17 19:42:40 +00:00
parent cfca3473b8
commit 32164ea8e5

View File

@ -68,7 +68,7 @@
static void ParseTypeSpec (DeclSpec* D, int Default); static void ParseTypeSpec (DeclSpec* D, int Default, type Qualifiers);
/* Parse a type specificier */ /* Parse a type specificier */
static unsigned ParseInitInternal (type* T, int AllowFlexibleMembers); static unsigned ParseInitInternal (type* T, int AllowFlexibleMembers);
@ -331,7 +331,7 @@ static SymEntry* ParseStructDecl (const char* Name, type StructType)
/* Get the type of the entry */ /* Get the type of the entry */
DeclSpec Spec; DeclSpec Spec;
InitDeclSpec (&Spec); InitDeclSpec (&Spec);
ParseTypeSpec (&Spec, -1); ParseTypeSpec (&Spec, -1, T_QUAL_NONE);
/* Read fields with this type */ /* Read fields with this type */
while (1) { while (1) {
@ -403,19 +403,18 @@ static SymEntry* ParseStructDecl (const char* Name, type StructType)
static void ParseTypeSpec (DeclSpec* D, int Default) static void ParseTypeSpec (DeclSpec* D, int Default, type Qualifiers)
/* Parse a type specificier */ /* Parse a type specificier */
{ {
ident Ident; ident Ident;
SymEntry* Entry; SymEntry* Entry;
type StructType; type StructType;
type Qualifiers; /* Type qualifiers */
/* Assume we have an explicit type */ /* Assume we have an explicit type */
D->Flags &= ~DS_DEF_TYPE; D->Flags &= ~DS_DEF_TYPE;
/* Read type qualifiers if we have any */ /* Read type qualifiers if we have any */
Qualifiers = OptionalQualifiers (T_QUAL_NONE); Qualifiers = OptionalQualifiers (Qualifiers);
/* Look at the data type */ /* Look at the data type */
switch (CurTok.Tok) { switch (CurTok.Tok) {
@ -1088,7 +1087,7 @@ type* ParseType (type* Type)
/* Get a type without a default */ /* Get a type without a default */
InitDeclSpec (&Spec); InitDeclSpec (&Spec);
ParseTypeSpec (&Spec, -1); ParseTypeSpec (&Spec, -1, T_QUAL_NONE);
/* Parse additional declarators */ /* Parse additional declarators */
ParseDecl (&Spec, &Decl, DM_NO_IDENT); ParseDecl (&Spec, &Decl, DM_NO_IDENT);
@ -1133,14 +1132,19 @@ void ParseDecl (const DeclSpec* Spec, Declaration* D, unsigned Mode)
void ParseDeclSpec (DeclSpec* D, unsigned DefStorage, int DefType) void ParseDeclSpec (DeclSpec* D, unsigned DefStorage, int DefType)
/* Parse a declaration specification */ /* Parse a declaration specification */
{ {
type Qualifiers;
/* Initialize the DeclSpec struct */ /* Initialize the DeclSpec struct */
InitDeclSpec (D); InitDeclSpec (D);
/* First, get the storage class specifier for this declaration */ /* There may be qualifiers *before* the storage class specifier */
Qualifiers = OptionalQualifiers (T_QUAL_NONE);
/* Now get the storage class specifier for this declaration */
ParseStorageClass (D, DefStorage); ParseStorageClass (D, DefStorage);
/* Parse the type specifiers */ /* Parse the type specifiers passing any initial type qualifiers */
ParseTypeSpec (D, DefType); ParseTypeSpec (D, DefType, Qualifiers);
} }