================
@@ -5181,6 +5181,18 @@ OptimizeNoneAttr *Sema::mergeOptimizeNoneAttr(Decl *D,
}
static void handleAlwaysInlineAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ AlwaysInlineAttr AIA(S.Context, AL);
+ if (!S.getLangOpts().MicrosoftExt &&
----------------
AaronBallman wrote:
> This forces me to disable this warning because of the usage
> `[[gnu::always_inline, msvc::forceinline]]`.
The idiomatic approach is to put the attributes behind a macro, as in:
```
#if __has_cpp_attribute(msvc::forceinline)
#define MSVC_FORCEINLINE [[msvc::forceinline]]
#else
#define MSVC_FORCEINLINE
#endif
#if __has_cpp_attribute(gnu::always_inline)
#define GNU_ALWAYS_INLINE [[gnu::always_inline]]
#else
#define GNU_ALWAYS_INLINE
#endif
```
this way the macros only expand when the attribute is actually known.
> Some other less esoteric [[msvc:: attributes are left unguarded, such as the
> opposite of the newly added attributes, [[msvc::noinline]]:
> https://godbolt.org/z/W8519n6d1
That's a compiler bug; the attribute should be diagnosed.
https://github.com/llvm/llvm-project/pull/185282
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits