diff options
Diffstat (limited to 'gcc/c-family/c-common.c')
-rw-r--r-- | gcc/c-family/c-common.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 92fb363..0329bc7 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -7073,22 +7073,6 @@ handle_visibility_attribute (tree *node, tree name, tree args, return NULL_TREE; } -/* Returns true iff DECL actually has visibility specified by an attribute. - We check for an explicit attribute, rather than just checking - DECL_VISIBILITY_SPECIFIED, to distinguish the use of an attribute from - the use of a "#pragma GCC visibility push(...)"; in the latter case we - still want other considerations to be able to overrule the #pragma. */ - -bool -decl_has_visibility_attr (tree decl) -{ - tree attrs = DECL_ATTRIBUTES (decl); - return (lookup_attribute ("visibility", attrs) - || (TARGET_DLLIMPORT_DECL_ATTRIBUTES - && (lookup_attribute ("dllimport", attrs) - || lookup_attribute ("dllexport", attrs)))); -} - /* Determine the ELF symbol visibility for DECL, which is either a variable or a function. It is an error to use this function if a definition of DECL is not available in this translation unit. @@ -7104,8 +7088,15 @@ c_determine_visibility (tree decl) /* If the user explicitly specified the visibility with an attribute, honor that. DECL_VISIBILITY will have been set during - the processing of the attribute. */ - if (decl_has_visibility_attr (decl)) + the processing of the attribute. We check for an explicit + attribute, rather than just checking DECL_VISIBILITY_SPECIFIED, + to distinguish the use of an attribute from the use of a "#pragma + GCC visibility push(...)"; in the latter case we still want other + considerations to be able to overrule the #pragma. */ + if (lookup_attribute ("visibility", DECL_ATTRIBUTES (decl)) + || (TARGET_DLLIMPORT_DECL_ATTRIBUTES + && (lookup_attribute ("dllimport", DECL_ATTRIBUTES (decl)) + || lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl))))) return true; /* Set default visibility to whatever the user supplied with |