diff options
| author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-04-19 22:49:48 +0000 |
|---|---|---|
| committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-04-19 22:49:48 +0000 |
| commit | 4b1984f57a55c32281e70753dff25b118ee0ac6c (patch) | |
| tree | be41a31f61cfc5955ed9ac031129b966e6b6e950 /gcc/cp/decl.c | |
| parent | 10f5722291a849f837907a4304914e1b212e9de4 (diff) | |
| download | ppe42-gcc-4b1984f57a55c32281e70753dff25b118ee0ac6c.tar.gz ppe42-gcc-4b1984f57a55c32281e70753dff25b118ee0ac6c.zip | |
* cp-tree.h (DECL_LANGUAGE): Don't assume DECL_LANG_SPECIFIC is
set.
(SET_DECL_LANGUAGE): New macro.
* decl.c (duplicate_decls): Use SET_DECL_LANGUAGE.
(pushdecl): Likewise.
(build_library_fn_1): Likewise.
(build_cp_library_fn): Likewise.
(grokfndecl): Likewise.
(grokvardecl): Mark `extern "C"' variables as having C linkage.
* decl2.c (grokclassfn): Use SET_DECL_LANGUAGE.
* lex.c (retrofit_lang_decl): Likewise.
* mangle.c (mangle_decl_string): Don't mangle the names of
variables declared with C language linkage.
* semantics.c (finish_member_declaration): Use SET_DECL_LANGUAGE.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41430 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
| -rw-r--r-- | gcc/cp/decl.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index fb6b8a3c27b..b72cf4fa4b6 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3203,7 +3203,7 @@ duplicate_decls (newdecl, olddecl) /* Make the old declaration consistent with the new one so that all remnants of the builtin-ness of this function will be banished. */ - DECL_LANGUAGE (olddecl) = DECL_LANGUAGE (newdecl); + SET_DECL_LANGUAGE (olddecl, DECL_LANGUAGE (newdecl)); SET_DECL_RTL (olddecl, DECL_RTL (newdecl)); COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl); SET_IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (newdecl), @@ -3362,7 +3362,7 @@ duplicate_decls (newdecl, olddecl) int foo () { bar (); } is OK. */ if (current_lang_depth () == 0) - DECL_LANGUAGE (newdecl) = DECL_LANGUAGE (olddecl); + SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl)); else { cp_error_at ("previous declaration of `%#D' with %L linkage", @@ -3676,7 +3676,7 @@ duplicate_decls (newdecl, olddecl) if (! types_match) { - DECL_LANGUAGE (olddecl) = DECL_LANGUAGE (newdecl); + SET_DECL_LANGUAGE (olddecl, DECL_LANGUAGE (newdecl)); COPY_DECL_ASSEMBLER_NAME (newdecl, olddecl); SET_DECL_RTL (olddecl, DECL_RTL (newdecl)); } @@ -3691,7 +3691,7 @@ duplicate_decls (newdecl, olddecl) if (new_defines_function) /* If defining a function declared with other language linkage, use the previously declared language linkage. */ - DECL_LANGUAGE (newdecl) = DECL_LANGUAGE (olddecl); + SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl)); else if (types_match) { /* If redeclaring a builtin function, and not a definition, @@ -3980,7 +3980,7 @@ pushdecl (x) if (DECL_NON_THUNK_FUNCTION_P (x) && ! DECL_LANG_SPECIFIC (x)) { retrofit_lang_decl (x); - DECL_LANGUAGE (x) = lang_c; + SET_DECL_LANGUAGE (x, lang_c); } if (DECL_NON_THUNK_FUNCTION_P (x) && ! DECL_FUNCTION_MEMBER_P (x)) @@ -6727,7 +6727,7 @@ build_library_fn_1 (name, operator_code, type) DECL_ARTIFICIAL (fn) = 1; TREE_NOTHROW (fn) = 1; SET_OVERLOADED_OPERATOR_CODE (fn, operator_code); - DECL_LANGUAGE (fn) = lang_c; + SET_DECL_LANGUAGE (fn, lang_c); return fn; } @@ -6754,7 +6754,7 @@ build_cp_library_fn (name, operator_code, type) tree fn = build_library_fn_1 (name, operator_code, type); TREE_NOTHROW (fn) = TYPE_NOTHROW_P (type); DECL_CONTEXT (fn) = FROB_CONTEXT (current_namespace); - DECL_LANGUAGE (fn) = lang_cplusplus; + SET_DECL_LANGUAGE (fn, lang_cplusplus); set_mangled_name_for_decl (fn); return fn; } @@ -8759,7 +8759,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, && ctype == NULL_TREE /* NULL_TREE means global namespace. */ && DECL_CONTEXT (decl) == NULL_TREE) - DECL_LANGUAGE (decl) = lang_c; + SET_DECL_LANGUAGE (decl, lang_c); /* Should probably propagate const out from type to decl I bet (mrs). */ if (staticp) @@ -9031,9 +9031,13 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace) else context = NULL_TREE; - if (processing_template_decl && context) - /* For global variables, declared in a template, we need the - full lang_decl. */ + /* For namespace-scope variables, declared in a template, we + need the full lang_decl. The same is true for + namespace-scope variables that do not have C++ language + linkage. */ + if (context + && (processing_template_decl + || current_lang_name != lang_name_cplusplus)) decl = build_lang_decl (VAR_DECL, declarator, type); else decl = build_decl (VAR_DECL, declarator, type); |

