@@ -10851,12 +10851,19 @@ if this routine has a body (dump nothing if it has no body).
1085110851 a_boolean is_marked_weak = FALSE;
1085210852 a_boolean thread_local_init_case = FALSE;
1085310853 a_boolean for_inlining_only ;
10854+ a_boolean inline_only_defn = FALSE;
10855+ a_boolean need_gnu_inline_attr = FALSE;
1085410856
1085510857 if (c99_mode && rout -> definition_for_inlining_only &&
10856- !gcc_version_is (< 50000 )) {
10858+ !gcc_version_is (< 50000 )
10859+ #if GNU_EXTENSIONS_ALLOWED
10860+ && !rout -> gnu_c89_inline
10861+ #endif /* GNU_EXTENSIONS_ALLOWED */
10862+ ) {
1085710863 /* This is a C99 "inline definition", so we must suppress the "extern"
1085810864 keyword to avoid turning it into an external definition. (gcc did
10859- not support C99 inline semantics until version 5.1.0.) */
10865+ not support C99 inline semantics until version 5.1.0. A routine with
10866+ the gnu_inline attribute follows the GNU C89 rules instead.) */
1086010867 for_inlining_only = TRUE;
1086110868 } else {
1086210869 for_inlining_only = FALSE;
@@ -10881,8 +10888,23 @@ if this routine has a body (dump nothing if it has no body).
1088110888 provided only for the purpose of inlining -- "extern inline".
1088210889 Put out the definition in that case. */
1088310890 has_defn = TRUE;
10891+ inline_only_defn = TRUE;
1088410892 if (!for_inlining_only ) {
1088510893 storage_class = (a_storage_class )sc_extern ;
10894+ /* "extern inline" is a definition only for inlining under the GNU
10895+ C89 rules, but an external definition under the C99 rules (the
10896+ gcc default since 5.1), so request the former with the gnu_inline
10897+ attribute. */
10898+ need_gnu_inline_attr = TRUE;
10899+ #if GCC_IS_GENERATED_CODE_TARGET
10900+ if (gcc_is_generated_code_target &&
10901+ gnu_target_version_number < 40200 ) {
10902+ need_gnu_inline_attr = FALSE;
10903+ } /* if */
10904+ #endif /* GCC_IS_GENERATED_CODE_TARGET */
10905+ #if GNU_EXTENSIONS_ALLOWED
10906+ if (rout -> gnu_c89_inline ) need_gnu_inline_attr = FALSE;
10907+ #endif /* GNU_EXTENSIONS_ALLOWED */
1088610908 } /* if */
1088710909 } /* if */
1088810910 } /* if */
@@ -11143,15 +11165,18 @@ if this routine has a body (dump nothing if it has no body).
1114311165#endif /* MICROSOFT_EXTENSIONS_ALLOWED */
1114411166 if (gcc_or_clang_is_generated_code_target && rout -> is_inline ) {
1114511167 /* gcc will be used to compile this generated code, so we know how to
11146- indicate an inline function. */
11147- /* gcc ignores __inline__ on functions with ellipses, so don't
11148- mark such functions as inline. Recent versions of gcc issue an
11149- error for a function marked both inline and weak, so don't mark a
11150- weak function as inline, either. */
11151- if (! f_skip_typerefs ( rout -> type ) -> variant . routine . extra_info ->
11152- has_ellipsis &&
11168+ indicate an inline function. gcc ignores __inline__ on functions
11169+ with ellipses, so don't mark such functions as inline. Also,
11170+ recent versions of gcc issue an error for a function marked both
11171+ inline and weak, so don't mark a weak function as inline either */
11172+ if ((! f_skip_typerefs ( rout -> type ) -> variant . routine . extra_info ->
11173+ has_ellipsis ||
11174+ inline_only_defn ) &&
1115311175 !is_marked_weak ) {
1115411176 write_tok_str ("__inline__ " );
11177+ if (need_gnu_inline_attr ) {
11178+ write_tok_str ("__attribute__((__gnu_inline__)) " );
11179+ } /* if */
1115511180 } /* if */
1115611181 } /* if */
1115711182#if GNU_EXTENSIONS_ALLOWED && !LOWER_IFUNC
0 commit comments