diff options
author | Geoffrey Keating <geoffk@apple.com> | 2006-11-01 04:47:30 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2006-11-01 04:47:30 +0000 |
commit | 71113fcd70d6b8851fa810c6a2f62fffec388f75 (patch) | |
tree | cf167878872183d2722b5e3979810401a81da5d0 /gcc/c-typeck.c | |
parent | 682d039597faffc4ec84e7a569b93e9447b3e681 (diff) | |
download | gcc-71113fcd70d6b8851fa810c6a2f62fffec388f75.zip gcc-71113fcd70d6b8851fa810c6a2f62fffec388f75.tar.gz gcc-71113fcd70d6b8851fa810c6a2f62fffec388f75.tar.bz2 |
re PR c/16622 ([C99] extern inline is handled wrong in C99 mode)
* c-decl.c (grokdeclarator): Don't set DECL_EXTERNAL on
inline static functions in c99 mode.
PR 16622
* doc/extend.texi (Inline): Update.
* c-tree.h (struct language_function): Remove field 'extern_inline'.
* c-decl.c (current_extern_inline): Delete.
(pop_scope): Adjust test for an undefined nested function.
Add warning about undeclared inline function.
(diagnose_mismatched_decls): Update comments. Disallow overriding
of inline functions in a translation unit in C99. Allow inline
declarations in C99 at any time.
(merge_decls): Boolize variables. Handle C99 'extern inline'
semantics.
(grokdeclarator): Set DECL_EXTERNAL here for functions. Handle
C99 inline semantics.
(start_function): Don't clear current_extern_inline. Don't set
DECL_EXTERNAL.
(c_push_function_context): Don't push current_extern_inline.
(c_pop_function_context): Don't restore current_extern_inline.
PR 11377
* c-typeck.c (build_external_ref): Warn about static variables
used in extern inline functions.
* c-decl.c (start_decl): Warn about static variables declared
in extern inline functions.
From-SVN: r118356
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r-- | gcc/c-typeck.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 2534c25..30b4382 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2109,6 +2109,17 @@ build_external_ref (tree id, int fun, location_t loc) if (context != 0 && context != current_function_decl) DECL_NONLOCAL (ref) = 1; } + /* C99 6.7.4p3: An inline definition of a function with external + linkage ... shall not contain a reference to an identifier with + internal linkage. */ + else if (current_function_decl != 0 + && DECL_DECLARED_INLINE_P (current_function_decl) + && DECL_EXTERNAL (current_function_decl) + && VAR_OR_FUNCTION_DECL_P (ref) + && (TREE_CODE (ref) != VAR_DECL || TREE_STATIC (ref)) + && ! TREE_PUBLIC (ref)) + pedwarn ("%H%qD is static but used in inline function %qD " + "which is not static", &loc, ref, current_function_decl); return ref; } |