diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-06-13 11:38:31 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-06-13 11:38:31 +0200 |
commit | 6cf598659e764d8955a1a90c32d2519ab689cea0 (patch) | |
tree | 5af24d70e0a73823535ae8c8ff4e6923ffecee6a /gcc/c-decl.c | |
parent | 6a4533e55451309198c5d36558a4b875b5555c88 (diff) | |
download | gcc-6cf598659e764d8955a1a90c32d2519ab689cea0.tar.gz |
re PR c/36507 (ISO C99 inline semantics doesn't play together with nested functions)
PR c/36507
* c-decl.c (merge_decls): Don't clear DECL_EXTERNAL for
nested inline functions.
(start_decl, start_function): Don't invert DECL_EXTERNAL
for nested inline functions.
* gcc.dg/inline-28.c: New test.
* gcc.dg/inline-29.c: New test.
* gcc.dg/inline-30.c: New test.
From-SVN: r136745
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9abb4dfc65f..89fdf3d1b45 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1763,7 +1763,9 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) || !DECL_DECLARED_INLINE_P (olddecl) || !DECL_EXTERNAL (olddecl)) && DECL_EXTERNAL (newdecl) - && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl))) + && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl)) + && (DECL_CONTEXT (newdecl) == NULL_TREE + || TREE_CODE (DECL_CONTEXT (newdecl)) != FUNCTION_DECL)) DECL_EXTERNAL (newdecl) = 0; if (DECL_EXTERNAL (newdecl)) @@ -3264,7 +3266,8 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, if (declspecs->inline_p && !flag_gnu89_inline && TREE_CODE (decl) == FUNCTION_DECL - && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl))) + && (lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl)) + || current_function_decl)) { if (declspecs->storage_class == csc_auto && current_scope != file_scope) ; @@ -6094,7 +6097,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, if (declspecs->inline_p && !flag_gnu89_inline && TREE_CODE (decl1) == FUNCTION_DECL - && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl1))) + && (lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl1)) + || current_function_decl)) { if (declspecs->storage_class != csc_static) DECL_EXTERNAL (decl1) = !DECL_EXTERNAL (decl1); |