Changes in src/Parser/parser.yy [1a73dbb:07e3652]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r1a73dbb r07e3652 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Feb 24 14:46:55202313 // Update Count : 5 98312 // Last Modified On : Tue Feb 14 21:11:39 2023 13 // Update Count : 5893 14 14 // 15 15 … … 1941 1941 // if type_specifier is an anon aggregate => name 1942 1942 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "4" ); 1943 $$ = $3->addType( $2 )->addTypedef(); // watchout frees $2 and $31943 $$ = $3->addType( $2 )->addTypedef(); 1944 1944 } 1945 1945 | typedef_declaration pop ',' push declarator … … 1983 1983 | typedef_expression // deprecated GCC, naming expression type 1984 1984 | sue_declaration_specifier 1985 {1986 assert( $1->type );1987 if ( $1->type->qualifiers.any() ) { // CV qualifiers ?1988 SemanticError( yylloc, "Useless type qualifier(s) in empty declaration." ); $$ = nullptr;1989 }1990 // enums are never empty declarations because there must have at least one enumeration.1991 if ( $1->type->kind == TypeData::AggregateInst && $1->storageClasses.any() ) { // storage class ?1992 SemanticError( yylloc, "Useless storage qualifier(s) in empty aggregate declaration." ); $$ = nullptr;1993 }1994 }1995 1985 ; 1996 1986 … … 2010 2000 | sue_declaration_specifier invalid_types 2011 2001 { 2012 SemanticError( yylloc, ::toString( "Missing ';' after end of ", 2013 $1->type->enumeration.name ? "enum" : AggregateDecl::aggrString( $1->type->aggregate.kind ), 2014 " declaration" ) ); 2002 SemanticError( yylloc, 2003 ::toString( "Missing ';' after end of ", 2004 $1->type->enumeration.name ? "enum" : AggregateDecl::aggrString( $1->type->aggregate.kind ), 2005 " declaration" ) ); 2015 2006 $$ = nullptr; 2016 2007 } … … 2591 2582 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}' 2592 2583 { 2593 if ( $3->storageClasses.val != 0 || $3->type->qualifiers. any())2584 if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) 2594 2585 { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); } 2595 2586 … … 2602 2593 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt identifier attribute_list_opt 2603 2594 { 2604 if ( $3->storageClasses. any()|| $3->type->qualifiers.val != 0 ) { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); }2595 if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); } 2605 2596 typedefTable.makeTypedef( *$6 ); 2606 2597 } … … 3061 3052 { $$ = DeclarationNode::newDirectiveStmt( new StatementNode( build_directive( $1 ) ) ); } 3062 3053 | declaration 3063 {3064 // Variable declarations of anonymous types requires creating a unique type-name across multiple translation3065 // unit, which is a dubious task, especially because C uses name rather than structural typing; hence it is3066 // disallowed at the moment.3067 if ( $1->linkage == LinkageSpec::Cforall && ! $1->storageClasses.is_static && $1->type && $1->type->kind == TypeData::AggregateInst ) {3068 if ( $1->type->aggInst.aggregate->kind == TypeData::Enum && $1->type->aggInst.aggregate->enumeration.anon ) {3069 SemanticError( yylloc, "extern anonymous enumeration is currently unimplemented." ); $$ = nullptr;3070 } else if ( $1->type->aggInst.aggregate->aggregate.anon ) { // handles struct or union3071 SemanticError( yylloc, "extern anonymous struct/union is currently unimplemented." ); $$ = nullptr;3072 }3073 }3074 }3075 3054 | IDENTIFIER IDENTIFIER 3076 3055 { IdentifierBeforeIdentifier( *$1.str, *$2.str, " declaration" ); $$ = nullptr; } … … 3118 3097 | type_qualifier_list 3119 3098 { 3120 if ( $1->type->qualifiers. any()) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); }3099 if ( $1->type->qualifiers.val ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); } 3121 3100 if ( $1->type->forall ) forall = true; // remember generic type 3122 3101 } … … 3129 3108 | declaration_qualifier_list 3130 3109 { 3131 if ( $1->type && $1->type->qualifiers. any()) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); }3110 if ( $1->type && $1->type->qualifiers.val ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); } 3132 3111 if ( $1->type && $1->type->forall ) forall = true; // remember generic type 3133 3112 } … … 3140 3119 | declaration_qualifier_list type_qualifier_list 3141 3120 { 3142 if ( ($1->type && $1->type->qualifiers. any()) || ($2->type && $2->type->qualifiers.any()) ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); }3121 if ( ($1->type && $1->type->qualifiers.val) || ($2->type && $2->type->qualifiers.val) ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); } 3143 3122 if ( ($1->type && $1->type->forall) || ($2->type && $2->type->forall) ) forall = true; // remember generic type 3144 3123 }
Note:
See TracChangeset
for help on using the changeset viewer.