@@ -1120,22 +1120,24 @@ get_symbol_decl (Declaration *decl)
1120
1120
d_keep (newfntype);
1121
1121
}
1122
1122
1123
- /* Miscellaneous function flags. */
1124
- if (fd->isMember2 () || fd->isFuncLiteralDeclaration ())
1123
+ /* In [pragma/inline], The attribute pragma(inline) affects whether a
1124
+ function should be inlined or not. */
1125
+ if (fd->inlining == PINLINEnever)
1126
+ DECL_UNINLINABLE (decl->csym ) = 1 ;
1127
+ else if (fd->inlining == PINLINEalways)
1128
+ {
1129
+ DECL_DECLARED_INLINE_P (decl->csym ) = 1 ;
1130
+ DECL_DISREGARD_INLINE_LIMITS (decl->csym ) = 1 ;
1131
+ DECL_COMDAT (decl->csym ) = 1 ;
1132
+ }
1133
+ else if (fd->isMember2 () || fd->isFuncLiteralDeclaration ())
1125
1134
{
1126
1135
/* See grokmethod in cp/decl.c. Maybe we shouldn't be setting inline
1127
1136
flags without reason or proper handling. */
1128
1137
DECL_DECLARED_INLINE_P (decl->csym ) = 1 ;
1129
1138
DECL_NO_INLINE_WARNING_P (decl->csym ) = 1 ;
1130
1139
}
1131
1140
1132
- /* Function was declared 'naked'. */
1133
- if (fd->naked )
1134
- {
1135
- DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl->csym ) = 1 ;
1136
- DECL_UNINLINABLE (decl->csym ) = 1 ;
1137
- }
1138
-
1139
1141
/* Vector array operations are always compiler generated. */
1140
1142
if (fd->isArrayOp )
1141
1143
{
@@ -1219,12 +1221,6 @@ get_symbol_decl (Declaration *decl)
1219
1221
DECL_EXTERNAL (decl->csym ) = 1 ;
1220
1222
1221
1223
d_comdat_linkage (decl->csym );
1222
-
1223
- /* Normally the backend only emits COMDAT things when they are needed.
1224
- If this decl is meant to be externally visible, then make sure that
1225
- to mark it so that it is indeed needed. */
1226
- if (TREE_PUBLIC (decl->csym ))
1227
- mark_needed (decl->csym );
1228
1224
}
1229
1225
else
1230
1226
{
@@ -1234,6 +1230,20 @@ get_symbol_decl (Declaration *decl)
1234
1230
else
1235
1231
DECL_EXTERNAL (decl->csym ) = 1 ;
1236
1232
}
1233
+
1234
+ /* Normally the backend only emits COMDAT things when they are needed.
1235
+ If this decl is meant to be externally visible, then make sure that
1236
+ to mark it so that it is indeed needed. */
1237
+ if (TREE_PUBLIC (decl->csym ) && (fd != NULL || ti != NULL ))
1238
+ {
1239
+ /* Don't keep functions declared pragma(inline, true) unless
1240
+ the user wants us to keep all inline functions. */
1241
+ if (fd && fd->inlining == PINLINEalways
1242
+ && !flag_keep_inline_functions)
1243
+ DECL_COMDAT (decl->csym ) = 1 ;
1244
+ else if (ti)
1245
+ mark_needed (decl->csym );
1246
+ }
1237
1247
}
1238
1248
1239
1249
/* Symbol is going in thread local storage. */
0 commit comments