Changeset 3cfe27f


Ignore:
Timestamp:
Mar 24, 2016, 4:45:23 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
1f6e009, 3aba311, 53ba273, b3f9a0cb
Parents:
6a57da5
Message:

fix initialization of routine pointers, fix one random routine

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.cc

    r6a57da5 r3cfe27f  
    63586358    {
    63596359                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    6360                         (yyval.decl) = (yyvsp[(1) - (2)].decl);
     6360                        (yyval.decl) = (yyvsp[(1) - (2)].decl)->addInitializer( (yyvsp[(2) - (2)].in) );
    63616361                }
    63626362    break;
     
    63686368    {
    63696369                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    6370                         (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) );
     6370                        (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addInitializer( (yyvsp[(3) - (3)].in) );;
    63716371                }
    63726372    break;
     
    63786378    {
    63796379                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (6)].tok), TypedefTable::ID );
    6380                         (yyval.decl) = (yyvsp[(1) - (6)].decl)->appendList( (yyvsp[(1) - (6)].decl)->cloneType( (yyvsp[(5) - (6)].tok) ) );
     6380                        (yyval.decl) = (yyvsp[(1) - (6)].decl)->appendList( (yyvsp[(1) - (6)].decl)->cloneType( (yyvsp[(5) - (6)].tok) )->addInitializer( (yyvsp[(6) - (6)].in) ) );
    63816381                }
    63826382    break;
  • src/Parser/parser.yy

    r6a57da5 r3cfe27f  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar 21 18:18:34 2016
    13 // Update Count     : 1497
     12// Last Modified On : Thu Mar 24 16:16:16 2016
     13// Update Count     : 1498
    1414//
    1515
     
    10291029                {
    10301030                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    1031                         $$ = $1;
     1031                        $$ = $1->addInitializer( $2 );
    10321032                }
    10331033        | declaration_qualifier_list new_variable_specifier initializer_opt
     
    10361036                {
    10371037                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    1038                         $$ = $2->addQualifiers( $1 );
     1038                        $$ = $2->addQualifiers( $1 )->addInitializer( $3 );;
    10391039                }
    10401040        | new_variable_declaration pop ',' push identifier_or_type_name initializer_opt
    10411041                {
    10421042                        typedefTable.addToEnclosingScope( *$5, TypedefTable::ID );
    1043                         $$ = $1->appendList( $1->cloneType( $5 ) );
     1043                        $$ = $1->appendList( $1->cloneType( $5 )->addInitializer( $6 ) );
    10441044                }
    10451045        ;
  • src/ResolvExpr/Resolver.cc

    r6a57da5 r3cfe27f  
    1010// Created On       : Sun May 17 12:17:01 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  9 21:57:52 2016
    13 // Update Count     : 179
     12// Last Modified On : Thu Mar 24 16:43:11 2016
     13// Update Count     : 181
    1414//
    1515
     
    165165                Type *new_type = resolveTypeof( objectDecl->get_type(), *this );
    166166                objectDecl->set_type( new_type );
     167                // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that class-variable
     168                // initContext is changed multiple time because the LHS is analysed twice. The second analysis changes
     169                // initContext because of a function type can contain object declarations in the return and parameter types. So
     170                // each value of initContext is retained, so the type on the first analysis is preserved and used for selecting
     171                // the RHS.
     172                Type *temp = initContext;
    167173                initContext = new_type;
    168174                SymTab::Indexer::visit( objectDecl );
     175                initContext = temp;
    169176        }
    170177
  • src/libcfa/stdlib.c

    r6a57da5 r3cfe27f  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 22 22:34:26 2016
    13 // Update Count     : 145
     12// Last Modified On : Wed Mar 23 13:26:42 2016
     13// Update Count     : 146
    1414//
    1515
     
    244244
    245245void rand48seed( long int s ) { srand48( s ); }
    246 char rand48() { return lrand48(); }
     246char rand48() { return mrand48(); }
    247247int rand48() { return mrand48(); }
    248248unsigned int rand48() { return lrand48(); }
Note: See TracChangeset for help on using the changeset viewer.