An improvement for __compiletime_assert and a trivial cleanup

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAmGGa5cACgkQGXyLc2ht
 IW3ckg//RRJKtZhhBEP9QwY3clvOgQg6M34CpkzN9L2QRAGTt93Ooee4Dk32Ep9I
 HT8D9BMqqvDS3ER7SrY49A7N+jaMRUxRIuehFX+yekI8YQ8GX2MEmKoyIN/JIE/U
 5rxXdW3H8EkG0mc6yaMtkCndWjhqBEE1lGg8kRFUNyga9pJvrpowRLDv6DAFULv1
 sVrsR4mCNEX7KF1Vef1Bblp1pijkW1C4Sgjfw++DwtetqtEGDjJgcu6d/Q6hKFtD
 Cbd10y+O7XLyumkJlSetAKD5VLtsxvBXmeYAwVeN/gnib1VCIvpQF2Srdvo2C6CS
 cQ2j9d8p9BozCbY+dC5Ax9DmCHo02CWVqa93/+J+dGevAeoFVJf+lGavZGnUqhhz
 tHATjU2mf16p/zbykZ0uVK9uC+h3Yfcpt9xmMkpaIVagZfHzrSYajd3y70borXCL
 B2rk6vbczlCmoKZsvuUKh1H5vLJTIGfB9soj22foyOHv7Km++DP+woFceo0JDthG
 BT2PpEgpwCXaqq0H4HFENET9aMrksu9mAKWJCXIy5BGII+GD2OU9ICobLDwOwW9l
 nQQmaEd7wF3nxUo3gJH9a6u7/wUqsD+IfsUTgy1RiQ2R8YFB0TZcv42IFiQ7eZpW
 Q0UhHuwH/Yw8Cf5YUi2xNS9NXiy5HEDfSrYMv8341tSStMZ0EV0=
 =STbj
 -----END PGP SIGNATURE-----

Merge tag 'compiler-attributes-for-linus-v5.16' of git://github.com/ojeda/linux

Pull compiler attributes update from Miguel Ojeda:
 "An improvement for `__compiletime_assert` and a trivial cleanup"

* tag 'compiler-attributes-for-linus-v5.16' of git://github.com/ojeda/linux:
  compiler_types: mark __compiletime_assert failure as __noreturn
  Compiler Attributes: remove GCC 5.1 mention
This commit is contained in:
Linus Torvalds 2021-11-07 10:38:17 -08:00
commit e54ffb96e6
2 changed files with 7 additions and 2 deletions

View File

@ -113,7 +113,6 @@
#define __deprecated
/*
* Optional: only supported since gcc >= 5.1
* Optional: not supported by clang
* Optional: not supported by icc
*

View File

@ -305,7 +305,13 @@ struct ftrace_likely_data {
#ifdef __OPTIMIZE__
# define __compiletime_assert(condition, msg, prefix, suffix) \
do { \
extern void prefix ## suffix(void) __compiletime_error(msg); \
/* \
* __noreturn is needed to give the compiler enough \
* information to avoid certain possibly-uninitialized \
* warnings (regardless of the build failing). \
*/ \
__noreturn extern void prefix ## suffix(void) \
__compiletime_error(msg); \
if (!(condition)) \
prefix ## suffix(); \
} while (0)