If the compiler supports [[noreturn]] as a attribute as in C23,
then we define sudo_noreturn to be it. When that's the case, we must place
it at the beginning of the declaration, before any other extension
attributes (__attribute(...)).
sudo_dso_public is always an extension attribute, while sudo_noreturn only
might be, so put it first.
This only shows up with GCC 13 so far (see the linked GCC bug (notabug)
for a bit more exploration). Clang 16 does support the attribute but doesn't let
you sue it for earlier language versions (need to pass explicit -std=c2x,
unlike with GCC here).
This is essentially a followup to e707ffe58b3ccfe5c72f54c38eac1d7069d5021e.
Tested with GCC 13.0.1 20230212 (unreleased), GCC 12.2.1 20230211,
Clang 16.0.0_rc2, and Clang 15.0.7.
If the compiler supports [[noreturn]] as a attribute as in C23, then we define sudo_noreturn to be it. When that's the case, we must place it at the beginning of the declaration, before any other extension attributes (__attribute(...)).
sudo_dso_public is always an extension attribute, while sudo_noreturn only might be, so put it first.
This only shows up with GCC 13 so far (see the linked GCC bug (notabug) for a bit more exploration). Clang 16 does support the attribute but doesn't let you sue it for earlier language versions (need to pass explicit -std=c2x, unlike with GCC here).
This is essentially a followup to e707ffe58b3ccfe5c72f54c38eac1d7069d5021e.
Tested with GCC 13.0.1 20230212 (unreleased), GCC 12.2.1 20230211, Clang 16.0.0_rc2, and Clang 15.0.7.
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796 Closes: https://github.com/sudo-project/sudo/issues/239 Fixes: e707ffe58b3ccfe5c72f54c38eac1d7069d5021e Fixes: 16ae61dcd7d3cd8bf6eb10a22fa742d4505da4e9