Changeset ac235a8


Ignore:
Timestamp:
Mar 29, 2023, 6:42:19 PM (20 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
ff443e5
Parents:
9fd9d015
Message:

deprecated qualifiers/specifiers before TYPEDEF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r9fd9d015 rac235a8  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 29 11:21:38 2023
    13 // Update Count     : 6321
     12// Last Modified On : Wed Mar 29 17:56:42 2023
     13// Update Count     : 6325
    1414//
    1515
     
    271271        SemanticError( yylloc, ::toString( "Identifier \"", identifier, "\" cannot appear before a ", kind, ".\n"
    272272                                   "Possible cause is misspelled storage/CV qualifier, misspelled typename, or missing generic parameter." ) );
    273 } // IdentifierBeforeType
    274 
    275 static bool TypedefForall( DeclarationNode * decl ) {
    276         if ( decl->type->forall || (decl->type->kind == TypeData::Aggregate && decl->type->aggregate.params) ) {
    277                 SemanticError( yylloc, "forall qualifier in typedef is currently unimplemented." );
    278                 return true;
    279         } // if
    280         return false;
    281273} // IdentifierBeforeType
    282274
     
    20192011                {
    20202012                        typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "4" );
    2021                         if ( TypedefForall( $2 ) ) $$ = nullptr;
    2022                         else $$ = $3->addType( $2 )->addTypedef();              // watchout frees $2 and $3
     2013                        if ( $2->type->forall || ($2->type->kind == TypeData::Aggregate && $2->type->aggregate.params) ) {
     2014                                SemanticError( yylloc, "forall qualifier in typedef is currently unimplemented." ); $$ = nullptr;
     2015                        } else $$ = $3->addType( $2 )->addTypedef(); // watchout frees $2 and $3
    20232016                }
    20242017        | typedef_declaration pop ',' push declarator
     
    20282021                }
    20292022        | type_qualifier_list TYPEDEF type_specifier declarator // remaining OBSOLESCENT (see 2 )
    2030                 {
    2031                         typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname, "6" );
    2032                         if ( TypedefForall( $1 ) ) $$ = nullptr;
    2033                         else $$ = $4->addQualifiers( $1 )->addType( $3 )->addTypedef();
    2034                 }
     2023                { SemanticError( yylloc, "Type qualifiers/specifiers before TYPEDEF is deprecated, move after TYPEDEF." ); $$ = nullptr; }
    20352024        | type_specifier TYPEDEF declarator
    2036                 {
    2037                         typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "7" );
    2038                         if ( TypedefForall( $1 ) ) $$ = nullptr;
    2039                         else $$ = $3->addType( $1 )->addTypedef();
    2040                 }
     2025                { SemanticError( yylloc, "Type qualifiers/specifiers before TYPEDEF is deprecated, move after TYPEDEF." ); $$ = nullptr; }
    20412026        | type_specifier TYPEDEF type_qualifier_list declarator
    2042                 {
    2043                         typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname, "8" );
    2044                         if ( TypedefForall( $3 ) ) $$ = nullptr;
    2045                         else $$ = $4->addQualifiers( $1 )->addType( $1 )->addTypedef();
    2046                 }
     2027                { SemanticError( yylloc, "Type qualifiers/specifiers before TYPEDEF is deprecated, move after TYPEDEF." ); $$ = nullptr; }
    20472028        ;
    20482029
     
    20512032        TYPEDEF identifier '=' assignment_expression
    20522033                {
    2053                         SemanticError( yylloc, "Typedef expression is deprecated, use typeof(...) instead." ); $$ = nullptr;
     2034                        SemanticError( yylloc, "TYPEDEF expression is deprecated, use typeof(...) instead." ); $$ = nullptr;
    20542035                }
    20552036        | typedef_expression pop ',' push identifier '=' assignment_expression
    20562037                {
    2057                         SemanticError( yylloc, "Typedef expression is deprecated, use typeof(...) instead." ); $$ = nullptr;
     2038                        SemanticError( yylloc, "TYPEDEF expression is deprecated, use typeof(...) instead." ); $$ = nullptr;
    20582039                }
    20592040        ;
Note: See TracChangeset for help on using the changeset viewer.