diff options
author | Shujing Zhao <pearly.zhao@oracle.com> | 2010-04-12 03:43:21 +0000 |
---|---|---|
committer | Shujing Zhao <pzhao@gcc.gnu.org> | 2010-04-12 03:43:21 +0000 |
commit | c4712597e1c5c51dc348628a52846026083c467d (patch) | |
tree | c9d1a94f68ad29d1a4a8f141264498a069c139af /gcc/c-decl.c | |
parent | fe5859f04b306556fcba138b4f30a6553378c23a (diff) | |
download | gcc-c4712597e1c5c51dc348628a52846026083c467d.zip gcc-c4712597e1c5c51dc348628a52846026083c467d.tar.gz gcc-c4712597e1c5c51dc348628a52846026083c467d.tar.bz2 |
re PR c/36774 (-Wmissing-prototypes triggers on nested functions)
gcc/
2010-04-12 Shujing Zhao <pearly.zhao@oracle.com>
PR c/36774
* c-decl.c (start_function): Move forward check for nested function.
gcc/testsuite/
2010-04-12 Shujing Zhao <pearly.zhao@oracle.com>
PR c/36774
* gcc.dg/pr36774-1.c: New test.
* gcc.dg/pr36774-2.c: New test.
From-SVN: r158214
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index bc90fdd..bf85557 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -7443,6 +7443,10 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, error_mark_node is replaced below (in pop_scope) with the BLOCK. */ DECL_INITIAL (decl1) = error_mark_node; + /* A nested function is not global. */ + if (current_function_decl != 0) + TREE_PUBLIC (decl1) = 0; + /* If this definition isn't a prototype and we had a prototype declaration before, copy the arg type info from that prototype. */ old_decl = lookup_name_in_scope (DECL_NAME (decl1), current_scope); @@ -7543,10 +7547,6 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, (This does not mean `static' in the C sense!) */ TREE_STATIC (decl1) = 1; - /* A nested function is not global. */ - if (current_function_decl != 0) - TREE_PUBLIC (decl1) = 0; - /* This is the earliest point at which we might know the assembler name of the function. Thus, if it's set before this, die horribly. */ gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl1)); |