diff options
Diffstat (limited to 'contrib/gcc/c-typeck.c')
-rw-r--r-- | contrib/gcc/c-typeck.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/gcc/c-typeck.c b/contrib/gcc/c-typeck.c index 912fd27..b2906ee 100644 --- a/contrib/gcc/c-typeck.c +++ b/contrib/gcc/c-typeck.c @@ -2109,6 +2109,19 @@ 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) + && DECL_FILE_SCOPE_P (ref) + && pedantic + && (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; } |