diff options
author | phython <phython@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-12-21 17:07:06 +0000 |
---|---|---|
committer | phython <phython@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-12-21 17:07:06 +0000 |
commit | fac8071d89cd78c169829ffc8f3381bbbd5f222e (patch) | |
tree | 0add9045f20f4db5dba3f2c3bb1fec81d63bfa1f /gcc | |
parent | 61ba37bfdc89277570f40931fdfeb82dfefc5585 (diff) | |
download | ppe42-gcc-fac8071d89cd78c169829ffc8f3381bbbd5f222e.tar.gz ppe42-gcc-fac8071d89cd78c169829ffc8f3381bbbd5f222e.zip |
2004-12-21 James A. Morrison <phython@gcc.gnu.org>
PR c/18963
* c-decl.c (pushdecl): Remove block trying to merge static function
declarations at block scope to file scope declarations.
testsuite:
PR c/18963
* gcc.dg/pr18963-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92460 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-decl.c | 24 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr18963-1.c | 29 |
4 files changed, 40 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3fc04174332..71a1525bc42 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2004-12-21 James A. Morrison <phython@gcc.gnu.org> + PR c/18963 + * c-decl.c (pushdecl): Remove block trying to merge static function + declarations at block scope to file scope declarations. + +2004-12-21 James A. Morrison <phython@gcc.gnu.org> + PR c/18596 * c-parse.in (initdcl): Don't process a declaration if start_decl fails. (notype_initdcl): Don't process a declaration if start_decl fails. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index f881ea8e052..975e281b5cf 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2069,30 +2069,6 @@ pushdecl (tree x) } } } - /* Similarly, a declaration of a function with static linkage at - block scope must be checked against any existing declaration - of that function at file scope. */ - else if (TREE_CODE (x) == FUNCTION_DECL && scope != file_scope - && !TREE_PUBLIC (x) && !DECL_INITIAL (x)) - { - if (warn_nested_externs && !DECL_IN_SYSTEM_HEADER (x)) - warning ("nested static declaration of %qD", x); - - while (b && !B_IN_FILE_SCOPE (b)) - b = b->shadowed; - - if (b && same_translation_unit_p (x, b->decl) - && duplicate_decls (x, b->decl)) - { - bind (name, b->decl, scope, /*invisible=*/false, /*nested=*/true); - return b->decl; - } - else - { - bind (name, x, file_scope, /*invisible=*/true, /*nested=*/false); - nested = true; - } - } warn_if_shadowing (x); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c742af3358..99ccef81863 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2004-12-21 James A. Morrison <phython@gcc.gnu.org> + PR c/18963 + * gcc.dg/pr18963-1.c: New test. + +2004-12-21 James A. Morrison <phython@gcc.gnu.org> + PR c/18596 * gcc.dg/funcdef-storage-1.c (foo): Remove. * gcc.dg/pr18596-1.c: Use dg-error. diff --git a/gcc/testsuite/gcc.dg/pr18963-1.c b/gcc/testsuite/gcc.dg/pr18963-1.c new file mode 100644 index 00000000000..df43c6543f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr18963-1.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "" } */ + +static int barf (); + +int foo () +{ + auto int barf (); + int j = 4; + + int barf () { + return j; + } + + return barf (); +} + +static int barf () { + return 3; +} + +extern void exit (int); +extern void abort (); + +int main (int argc, char *argv[]) { + if (foo () != 4) + abort (); + exit (0); +} |