aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1994-07-12 18:37:25 -0700
committerJim Wilson <wilson@gcc.gnu.org>1994-07-12 18:37:25 -0700
commit93f623faa97cf6a4a92e9b1b575c8b6c99fa898c (patch)
tree1dee5945e248cf22ae45cdc358c414fc727ce1df /gcc
parent1ba298e52539bbac52f2bd25689db74672438f0c (diff)
downloadgcc-93f623faa97cf6a4a92e9b1b575c8b6c99fa898c.zip
gcc-93f623faa97cf6a4a92e9b1b575c8b6c99fa898c.tar.gz
gcc-93f623faa97cf6a4a92e9b1b575c8b6c99fa898c.tar.bz2
(pushdecl): Don't call lookup_name_current_level_global when traditional.
(pushdecl): Don't call lookup_name_current_level_global when traditional. When doing checks against IDENTIFIER_LIMBO_VALUE, also do check against INDENTIFIER_GLOBAL_VALUE when traditional. From-SVN: r7756
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-decl.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 0a4b1f1..c1a8dc9 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1842,7 +1842,10 @@ pushdecl (x)
char *file;
int line;
- if (DECL_EXTERNAL (x) && TREE_PUBLIC (x))
+ /* Don't type check externs here when -traditional. This is so that
+ code with conflicting declarations inside blocks will get warnings
+ not errors. X11 for instance depends on this. */
+ if (DECL_EXTERNAL (x) && TREE_PUBLIC (x) && ! flag_traditional)
t = lookup_name_current_level_global (name);
else
t = lookup_name_current_level (name);
@@ -1953,20 +1956,26 @@ pushdecl (x)
}
/* Multiple external decls of the same identifier ought to match.
- Check against out of scope (limbo) block level declarations.
-
- If this is a block level declaration, then DECL_EXTERNAL must also
- be set, so we have already checked against global declarations above
- via the lookup_name call.
+ Check against both global declarations (when traditional) and out of
+ scope (limbo) block level declarations.
We get warnings about inline functions where they are defined.
Avoid duplicate warnings where they are used. */
- if (TREE_PUBLIC (x) && ! DECL_INLINE (x)
- && IDENTIFIER_LIMBO_VALUE (name))
+ if (TREE_PUBLIC (x) && ! DECL_INLINE (x))
{
- tree decl = IDENTIFIER_LIMBO_VALUE (name);
+ tree decl;
+
+ if (flag_traditional && IDENTIFIER_GLOBAL_VALUE (name) != 0
+ && (DECL_EXTERNAL (IDENTIFIER_GLOBAL_VALUE (name))
+ || TREE_PUBLIC (IDENTIFIER_GLOBAL_VALUE (name))))
+ decl = IDENTIFIER_GLOBAL_VALUE (name);
+ else if (IDENTIFIER_LIMBO_VALUE (name) != 0)
+ /* Decls in limbo are always extern, so no need to check that. */
+ decl = IDENTIFIER_LIMBO_VALUE (name);
+ else
+ decl = 0;
- if (! comptypes (TREE_TYPE (x), TREE_TYPE (decl))
+ if (decl && ! comptypes (TREE_TYPE (x), TREE_TYPE (decl))
/* If old decl is built-in, we already warned if we should. */
&& !DECL_BUILT_IN (decl))
{