Changes in / [8655363:4d689e2]
- Location:
- src
- Files:
-
- 3 edited
-
AST/Attribute.cpp (modified) (1 diff)
-
Validate/Autogen.cpp (modified) (1 diff)
-
Validate/ReplaceTypedef.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Attribute.cpp
r8655363 r4d689e2 38 38 39 39 bool Attribute::isValidOnFuncParam() const { 40 // Attributes produce GCC errors when they appear on function 41 // parameters. This is an allow-list, switching to a forbid-list would 42 // have to at least mention: 43 // aligned 40 // attributes such as aligned, cleanup, etc. produce GCC errors when they appear 41 // on function parameters. Maintain here a whitelist of attribute names that are 42 // allowed to appear on parameters. 44 43 std::string norm = normalizedName(); 45 return norm == "unused" || norm == "noreturn" || norm == "vector_size";44 return norm == "unused" || norm == "noreturn"; 46 45 } 47 46 -
src/Validate/Autogen.cpp
r8655363 r4d689e2 440 440 441 441 auto * paramType = ast::deepCopy( member->get_type() ); 442 erase_if( paramType->attributes, []( ast::Attribute const * attr ){ 443 return !attr->isValidOnFuncParam(); 444 } ); 442 paramType->attributes.clear(); 445 443 ast::ObjectDecl * param = new ast::ObjectDecl( 446 444 getLocation(), member->name, paramType ); -
src/Validate/ReplaceTypedef.cpp
r8655363 r4d689e2 25 25 26 26 namespace { 27 28 bool isNonParameterAttribute( ast::Attribute const * attr ) { 29 static const std::vector<std::string> bad_names = { 30 "aligned", "__aligned__", 31 }; 32 for ( auto name : bad_names ) { 33 if ( name == attr->name ) { 34 return true; 35 } 36 } 37 return false; 38 } 27 39 28 40 struct ReplaceTypedefCore final : … … 89 101 // by typedef. GCC appears to do the same thing. 90 102 if ( isAtFunctionTop ) { 91 erase_if( ret->attributes, []( ast::Attribute const * attr ){ 92 return !attr->isValidOnFuncParam(); 93 } ); 103 erase_if( ret->attributes, isNonParameterAttribute ); 94 104 } 95 105 for ( const auto & attribute : type->attributes ) {
Note:
See TracChangeset
for help on using the changeset viewer.