Changeset 8884112
- Timestamp:
- Jul 13, 2016, 1:43:57 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- d1b9d78
- Parents:
- a3e1f8f
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
ra3e1f8f r8884112 527 527 528 528 return tables->base.hasIncompatibleCDecl( id, mangleName, scope ); 529 } 530 531 bool Indexer::hasCompatibleCDecl( const std::string &id, const std::string &mangleName, unsigned long scope ) const { 532 if ( ! tables ) return false; 533 if ( tables->scope < scope ) return false; 534 535 IdTable::const_iterator decls = tables->idTable.find( id ); 536 if ( decls != tables->idTable.end() ) { 537 const MangleTable &mangleTable = decls->second; 538 for ( MangleTable::const_iterator decl = mangleTable.begin(); decl != mangleTable.end(); ++decl ) { 539 // check for C decls with the same name, skipping 540 // those with an incompatible type (by mangleName) 541 if ( decl->second->get_linkage() == LinkageSpec::C && decl->first == mangleName ) return true; 542 } 543 } 544 545 return tables->base.hasCompatibleCDecl( id, mangleName, scope ); 529 546 } 530 547 … … 617 634 } // if 618 635 636 // this ensures that no two declarations with the same unmangled name at the same scope both have C linkage 637 if ( decl->get_linkage() == LinkageSpec::C ) { 638 // NOTE this is broken in Richard's original code in such a way that it never triggers (it 639 // doesn't check decls that have the same manglename, and all C-linkage decls are defined to 640 // have their name as their manglename, hence the error can never trigger). 641 // The code here is closer to correct, but name mangling would have to be completely 642 // isomorphic to C type-compatibility, which it may not be. 643 if ( hasIncompatibleCDecl( name, mangleName, scope ) ) { 644 throw SemanticError( "conflicting overload of C function ", decl ); 645 } 646 } else { 647 // Check that a Cforall declaration doesn't overload any C declaration 648 if ( hasCompatibleCDecl( name, mangleName, scope ) ) { 649 throw SemanticError( "Cforall declaration hides C function ", decl ); 650 } 651 } 652 653 // Skip repeat declarations of the same identifier 619 654 DeclarationWithType *existing = lookupIdAtScope( name, mangleName, scope ); 620 if ( ! existing || ! addedIdConflicts( existing, decl ) ) { 621 // this ensures that no two declarations with the same unmangled name at the same scope both have C linkage 622 if ( decl->get_linkage() == LinkageSpec::C && hasIncompatibleCDecl( name, mangleName, scope ) ) { 623 throw SemanticError( "invalid overload of C function ", decl ); 624 } // NOTE this is broken in Richard's original code in such a way that it never triggers (it 625 // doesn't check decls that have the same manglename, and all C-linkage decls are defined to 626 // have their name as their manglename, hence the error can never trigger). 627 // The code here is closer to correct, but name mangling would have to be completely 628 // isomorphic to C type-compatibility, which it may not be. 629 630 tables->idTable[ name ][ mangleName ] = decl; 631 ++tables->size; 632 } 655 if ( existing && addedIdConflicts( existing, decl ) ) return; 656 657 // add to indexer 658 tables->idTable[ name ][ mangleName ] = decl; 659 ++tables->size; 633 660 } 634 661 -
src/SymTab/Indexer.h
ra3e1f8f r8884112 100 100 /// returns true if there exists a declaration with C linkage and the given name with a different mangled name 101 101 bool hasIncompatibleCDecl( const std::string &id, const std::string &mangleName, unsigned long scope ) const; 102 /// returns true if there exists a declaration with C linkage and the given name with the same mangled name 103 bool hasCompatibleCDecl( const std::string &id, const std::string &mangleName, unsigned long scope ) const; 102 104 // equivalents to lookup functions that only look at tables at scope `scope` (which should be >= tables->scope) 103 105 NamedTypeDecl *lookupTypeAtScope( const std::string &id, unsigned long scope ) const; -
src/SymTab/Mangler.cc
ra3e1f8f r8884112 282 282 mangleName << "V"; 283 283 } // if 284 if ( type->get_isRestrict() ) { 285 mangleName << "R"; 286 } // if 284 // Removed due to restrict not affecting function compatibility in GCC 285 // if ( type->get_isRestrict() ) { 286 // mangleName << "R"; 287 // } // if 287 288 if ( type->get_isLvalue() ) { 288 289 mangleName << "L"; -
src/libcfa/math
ra3e1f8f r8884112 184 184 185 185 float atan2( float, float ); 186 double atan2( double, double ); 186 // extern "C" { double atan2( double, double ); } 187 187 long double atan2( long double, long double ); 188 188 -
src/libcfa/math.c
ra3e1f8f r8884112 23 23 long double fabs( long double x ) { return fabsl( x ); } 24 24 float cabs( float _Complex x ) { return cabsf( x ); } 25 double cabs( double _Complex x ) { return cabs( x ); }26 25 long double cabs( long double _Complex x ) { return cabsl( x ); } 27 26 … … 159 158 160 159 float atan2( float x, float y ) { return atan2f( x, y ); } 161 double atan2( double x, double y ) { return atan2( x, y ); }162 160 long double atan2( long double x, long double y ) { return atan2l( x, y ); } 163 161
Note: See TracChangeset
for help on using the changeset viewer.