diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-09-23 02:04:33 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-09-23 02:04:33 +0000 |
commit | 5fdaba89421ba0d09b316db6ecd457549f1a4ca6 (patch) | |
tree | b92af04f73f780e1b9d1f304f1f89d5e9759730f | |
parent | 8da665d583ad51bbba86a5e135dfc33d4b764455 (diff) | |
download | gcc-5fdaba89421ba0d09b316db6ecd457549f1a4ca6.zip gcc-5fdaba89421ba0d09b316db6ecd457549f1a4ca6.tar.gz gcc-5fdaba89421ba0d09b316db6ecd457549f1a4ca6.tar.bz2 |
decl.c (pushdecl): Do create a binding for extern "C" functions...
* decl.c (pushdecl): Do create a binding for extern "C" functions,
but not for their DECL_ASSEMBLER_NAMEs.
(lookup_name_current_level): Fix formatting.
(xref_tag): Likewise.
* decl2.c (start_objects): Mark static constructors and
destructors as used.
From-SVN: r29609
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/decl.c | 20 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 3 |
3 files changed, 24 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 25f9057..350a927 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +1999-09-22 Mark Mitchell <mark@codesourcery.com> + + * decl.c (pushdecl): Do create a binding for extern "C" functions, + but not for their DECL_ASSEMBLER_NAMEs. + (lookup_name_current_level): Fix formatting. + (xref_tag): Likewise. + * decl2.c (start_objects): Mark static constructors and + destructors as used. + 1999-09-22 Jason Merrill <jason@yorick.cygnus.com> * decl.c (define_case_label): Don't crash if we're not in a switch. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a6706b5..1e63523 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3806,7 +3806,7 @@ pushdecl (x) if (TREE_CODE (x) == FUNCTION_DECL && ! DECL_FUNCTION_MEMBER_P (x)) { t = push_overloaded_decl (x, PUSH_LOCAL); - if (t != x || DECL_LANGUAGE (x) == lang_c) + if (t != x) return t; if (!namespace_bindings_p ()) /* We do not need to create a binding for this name; @@ -3898,7 +3898,13 @@ pushdecl (x) TREE_PUBLIC (name) = 1; if (!(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x) - && t != NULL_TREE)) + && t != NULL_TREE) + /* For an ordinary function, we create a binding from + the mangled name (i.e., NAME) to the DECL. But, for + an `extern "C"' function, the mangled name and the + ordinary name are the same so we need not do this. */ + && !(TREE_CODE (x) == FUNCTION_DECL && + DECL_LANGUAGE (x) == lang_c)) { if (TREE_CODE (x) == FUNCTION_DECL) my_friendly_assert @@ -5766,7 +5772,7 @@ lookup_name_current_level (name) if (b->namespace_p) { - t = IDENTIFIER_NAMESPACE_VALUE (name); + t = IDENTIFIER_NAMESPACE_VALUE (name); /* extern "C" function() */ if (t != NULL_TREE && TREE_CODE (t) == TREE_LIST) @@ -12138,11 +12144,9 @@ xref_tag (code_type_node, name, globalize) in global scope. If it is not an IDENTIFIER, this is not a declaration */ if (b->namespace_p && !class_binding_level - && TREE_CODE (name) == IDENTIFIER_NODE) - { - if (IDENTIFIER_NAMESPACE_VALUE (name) == NULL_TREE) - SET_IDENTIFIER_NAMESPACE_VALUE (name, TYPE_NAME (ref)); - } + && TREE_CODE (name) == IDENTIFIER_NODE + && IDENTIFIER_NAMESPACE_VALUE (name) == NULL_TREE) + SET_IDENTIFIER_NAMESPACE_VALUE (name, TYPE_NAME (ref)); if (!globalize && processing_template_decl && IS_AGGR_TYPE (ref)) redeclare_class_template (ref, current_template_parms); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 262d6a1..0b8083a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2789,6 +2789,9 @@ start_objects (method_type, initp) TREE_PUBLIC (current_function_decl) = 0; #endif + /* Mark this declaration as used to avoid spurious warnings. */ + TREE_USED (current_function_decl) = 1; + store_parm_decls (); pushlevel (0); clear_last_expr (); |