summaryrefslogtreecommitdiffstats
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-02-08 01:59:11 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-02-08 01:59:11 +0000
commita3ad3e27edff7998572d4bb4c4f4e8ce6466d4e2 (patch)
treed4cd835e75cfa41869573447cf76d5e4dc2453ad /gcc/c-decl.c
parentb1c4a3aac918c702dfb6a235d517117bda3db1df (diff)
downloadppe42-gcc-a3ad3e27edff7998572d4bb4c4f4e8ce6466d4e2.tar.gz
ppe42-gcc-a3ad3e27edff7998572d4bb4c4f4e8ce6466d4e2.zip
* c-common.c (shadow_warning): Delete.
* c-common.h (free_parser_stacks, shadow_warning, sw_kind): Delete. * c-decl.c (warn_if_shadowing): Issue shadow warnings directly. * c-opts.c (c_common_parse_file): Don't call free_parser_stacks. * c-parse.in (free_parser_stacks): Delete. cp: * name-lookup.c (pushdecl): Issue shadow warnings directly. * parser.c (free_parser_stacks): Delete. testsuite: * gcc.c-torture/execute/string-opt-15.c: Define memcmp with void * arguments. * gcc.dg/fwritable-strings-1.c: Expect the deprecation notice. ------ Bug 13856 * c-decl.c (diagnose_mismatched_decls): Only give special treatment when olddecl is DECL_BUILT_IN, if C_DECL_INVISIBLE is also true. (merge_decls): Don't clear DECL_BUILT_IN_CLASS and DECL_FUNCTION_CODE when defining a built-in function. Don't update DECL_ESTIMATED_INSNS. * dwarf2out.c (dwarf2out_decl): Don't ignore built-in FUNCTION_DECLs. * tree.h: Delete DECL_ESTIMATED_INSNS. * tree-inline.c (struct inline_data): Delete inlined_insns field. (expand_call_inline, optimize_inline_calls): Don't update DECL_ESTIMATED_INSNS nor inlined_insns. * cgraphunit.c (cgraph_analyze_function): Don't update DECL_ESTIMATED_INSNS. cp: * optimize.c (maybe_clone_body): Don't update DECL_ESTIMATED_INSNS. * decl.c (duplicate_decls, start_function): Likewise. testsuite: * gcc.dg/visibility-8.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77475 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index c0cd2193386..87d24a9ead4 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -939,7 +939,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
unless OLDDECL is a builtin. OLDDECL will be discarded in any case. */
if (TREE_CODE (olddecl) != TREE_CODE (newdecl))
{
- if (TREE_CODE (olddecl) != FUNCTION_DECL || !DECL_BUILT_IN (olddecl))
+ if (TREE_CODE (olddecl) != FUNCTION_DECL
+ || !DECL_BUILT_IN (olddecl) || !C_DECL_INVISIBLE (olddecl))
{
error ("%J'%D' redeclared as different kind of symbol",
newdecl, newdecl);
@@ -956,7 +957,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (!comptypes (oldtype, newtype, COMPARE_STRICT))
{
- if (TREE_CODE (olddecl) == FUNCTION_DECL && DECL_BUILT_IN (olddecl))
+ if (TREE_CODE (olddecl) == FUNCTION_DECL
+ && DECL_BUILT_IN (olddecl) && C_DECL_INVISIBLE (olddecl))
{
/* Accept harmless mismatch in function types.
This is for the ffs and fprintf builtins. */
@@ -1034,6 +1036,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
can't validate the argument list) the built-in definition is
overridden, but optionally warn this was a bad choice of name. */
if (DECL_BUILT_IN (olddecl)
+ && C_DECL_INVISIBLE (olddecl)
&& (!TREE_PUBLIC (newdecl)
|| (DECL_INITIAL (newdecl)
&& !TYPE_ARG_TYPES (TREE_TYPE (newdecl)))))
@@ -1428,20 +1431,9 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
if (DECL_BUILT_IN (olddecl))
{
- /* Get rid of any built-in function if we have a function
- definition. */
- if (new_is_definition)
- {
- TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
- DECL_BUILT_IN_CLASS (olddecl) = NOT_BUILT_IN;
- }
- else
- {
- /* If redeclaring a builtin function, and not a definition,
- it stays built in. */
- DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
- DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
- }
+ /* If redeclaring a builtin function, it stays built in. */
+ DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
+ DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
}
/* Also preserve various other info from the definition. */
@@ -1451,7 +1443,6 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl);
DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
- DECL_ESTIMATED_INSNS (newdecl) = DECL_ESTIMATED_INSNS (olddecl);
DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
/* Set DECL_INLINE on the declaration if we've got a body
@@ -1553,8 +1544,6 @@ record_external_decl (tree decl)
static void
warn_if_shadowing (tree x, tree old)
{
- const char *name;
-
/* Nothing to shadow? */
if (old == 0
/* Shadow warnings not wanted? */
@@ -1571,13 +1560,14 @@ warn_if_shadowing (tree x, tree old)
|| (TREE_CODE (x) == PARM_DECL && current_scope->outer->parm_flag))
return;
- name = IDENTIFIER_POINTER (DECL_NAME (x));
if (TREE_CODE (old) == PARM_DECL)
- shadow_warning (SW_PARAM, name, old);
+ warning ("%Jdeclaration of '%D' shadows a parameter", x, x);
else if (DECL_FILE_SCOPE_P (old))
- shadow_warning (SW_GLOBAL, name, old);
+ warning ("%Jdeclaration of '%D' shadows a global declaration", x, x);
else
- shadow_warning (SW_LOCAL, name, old);
+ warning ("%Jdeclaration of '%D' shadows a previous local", x, x);
+
+ warning ("%Jshadowed declaration is here", old);
}
OpenPOWER on IntegriCloud