diff options
author | Matt Austern <austern@apple.com> | 2003-11-06 22:08:26 +0000 |
---|---|---|
committer | Matt Austern <austern@gcc.gnu.org> | 2003-11-06 22:08:26 +0000 |
commit | 968b41a1662526b8b3eb5861f7fb369450ff9644 (patch) | |
tree | c4ffb9b377ba06be592c6688dd70529152203fd4 /gcc/c-common.c | |
parent | 63e292b7ec0ae980f7ffa763448c81a923a72321 (diff) | |
download | gcc-968b41a1662526b8b3eb5861f7fb369450ff9644.zip gcc-968b41a1662526b8b3eb5861f7fb369450ff9644.tar.gz gcc-968b41a1662526b8b3eb5861f7fb369450ff9644.tar.bz2 |
c-common.c (handle_visibility_attribute): Set DECL_VISIBILITY field instead of hanging an attribute object off the decl.
* c-common.c (handle_visibility_attribute): Set DECL_VISIBILITY
field instead of hanging an attribute object off the decl.
* tree.h (DECL_VISIBLITY): New accessor macro for
symbol_visibility field in struct tree_decl.
(enum symbol_visibility): Move definition to before tree_decl.
(struct tree_decl): Define new two-bit field, symbol_visibility.
(decl_visibility): Remove declaration.
* varasm.c (maybe_assemble_visibility): Use DECL_VISIBILITY
instead of decl_visibility.
(default_binds_local_p_1): Use DECL_VISIBILITY instead of
decl_visibility.
(decl_visibility): Remove.
* cp/decl.c (duplicate_decls): copy DECL_VISIBILITY field.
* cp/method.c (use_thunk): give thunk same visibility as function.
* cp/optimize.c (maybe_clone_body): copy DECL_VISIBILITY field.
From-SVN: r73320
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 1d32d96..f587fb2 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -4929,34 +4929,33 @@ handle_visibility_attribute (tree *node, tree name, tree args, bool *no_add_attrs) { tree decl = *node; + tree id = TREE_VALUE (args); + + *no_add_attrs = true; if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl)) { warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - *no_add_attrs = true; + return NULL_TREE; } - else - { - tree id; - id = TREE_VALUE (args); - if (TREE_CODE (id) != STRING_CST) - { - error ("visibility arg not a string"); - *no_add_attrs = true; - return NULL_TREE; - } - if (strcmp (TREE_STRING_POINTER (id), "hidden") - && strcmp (TREE_STRING_POINTER (id), "protected") - && strcmp (TREE_STRING_POINTER (id), "internal") - && strcmp (TREE_STRING_POINTER (id), "default")) - { - error ("visibility arg must be one of \"default\", \"hidden\", \"protected\" or \"internal\""); - *no_add_attrs = true; - return NULL_TREE; - } + if (TREE_CODE (id) != STRING_CST) + { + error ("visibility arg not a string"); + return NULL_TREE; } + if (strcmp (TREE_STRING_POINTER (id), "default") == 0) + DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT; + else if (strcmp (TREE_STRING_POINTER (id), "internal") == 0) + DECL_VISIBILITY (decl) = VISIBILITY_INTERNAL; + else if (strcmp (TREE_STRING_POINTER (id), "hidden") == 0) + DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN; + else if (strcmp (TREE_STRING_POINTER (id), "protected") == 0) + DECL_VISIBILITY (decl) = VISIBILITY_PROTECTED; + else + error ("visibility arg must be one of \"default\", \"hidden\", \"protected\" or \"internal\""); + return NULL_TREE; } |