diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-11-27 06:13:23 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-11-27 06:13:23 +0000 |
commit | 8cf34b34f883b383072b1ee2cde9584f97c19de6 (patch) | |
tree | 81aceb060743bb202f3bdc25d65782869844092b /gcc/varasm.c | |
parent | 9eb844027b3e7d0150349f9fa8324bbfaff8b5f6 (diff) | |
download | gcc-8cf34b34f883b383072b1ee2cde9584f97c19de6.tar.gz |
* c-common.c (handle_visibility_attribute): Accept "default".
* tree.h (enum symbol_visibility): New.
(decl_visibility): Declare.
* target.h (gcc_target.visibility): Take visibility arg as integer.
* varasm.c (default_assemble_visibility): Likewise.
(decl_visibility): New.
(maybe_assemble_visibility): Use it.
* output.h (default_assemble_visibility): Update prototype.
* config/rs6000/rs6000.c (rs6000_assemble_visibility): Take
visibility arg as integer.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59559 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index db7599e7212..2ac3da5338c 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4643,20 +4643,25 @@ assemble_alias (decl, target) } /* Emit an assembler directive to set symbol for DECL visibility to - VISIBILITY_TYPE. */ + the visibility type VIS, which must not be VISIBILITY_DEFAULT. */ void -default_assemble_visibility (decl, visibility_type) +default_assemble_visibility (decl, vis) tree decl; - const char *visibility_type ATTRIBUTE_UNUSED; + int vis; { - const char *name; + static const char * const visibility_types[] = { + NULL, "internal", "hidden", "protected" + }; + + const char *name, *type; name = (* targetm.strip_name_encoding) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); + type = visibility_types[vis]; #ifdef HAVE_GAS_HIDDEN - fprintf (asm_out_file, "\t.%s\t%s\n", visibility_type, name); + fprintf (asm_out_file, "\t.%s\t%s\n", type, name); #else warning ("visibility attribute not supported in this configuration; ignored"); #endif @@ -4668,13 +4673,10 @@ static void maybe_assemble_visibility (decl) tree decl; { - tree visibility = lookup_attribute ("visibility", DECL_ATTRIBUTES (decl)); - if (visibility) - { - const char *type - = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (visibility))); - (* targetm.asm_out.visibility) (decl, type); - } + enum symbol_visibility vis = decl_visibility (decl); + + if (vis != VISIBILITY_DEFAULT) + (* targetm.asm_out.visibility) (decl, vis); } /* Returns 1 if the target configuration supports defining public symbols @@ -4775,6 +4777,31 @@ decl_tls_model (decl) return kind; } +enum symbol_visibility +decl_visibility (decl) + tree decl; +{ + tree attr = lookup_attribute ("visibility", DECL_ATTRIBUTES (decl)); + + if (attr) + { + const char *which = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))); + + if (strcmp (which, "default") == 0) + return VISIBILITY_DEFAULT; + if (strcmp (which, "internal") == 0) + return VISIBILITY_INTERNAL; + if (strcmp (which, "hidden") == 0) + return VISIBILITY_HIDDEN; + if (strcmp (which, "protected") == 0) + return VISIBILITY_PROTECTED; + + abort (); + } + + return VISIBILITY_DEFAULT; +} + /* Select a set of attributes for section NAME based on the properties of DECL and whether or not RELOC indicates that DECL's initializer might contain runtime relocations. |