Closed kkysen closed 1 month ago
I think we should replace our uses of _Noreturn
with __attribute__((__noreturn__))
instead.
I think we should replace our uses of
_Noreturn
with__attribute__((__noreturn__))
instead.
In all cases, or just pre C11?
All cases. Glibc sometimes defines it as #define _Noreturn
but I think that's just for old versions of gcc and unrecognized attributes should be ignored anyway. (Also I linked to our repo's glibc sysroot out of convenience but we don't use it on x86 in case that wasn't clear.)
All cases. Glibc sometimes defines it as
#define _Noreturn
but I think that's just for old versions of gcc and unrecognized attributes should be ignored anyway. (Also I linked to our repo's glibc sysroot out of convenience but we don't use it on x86 in case that wasn't clear.)
Should I do something like #define _Noreturn __attribute__((__noreturn__))
or just use __attribute__((__noreturn__))
inline in each case (just more verbose I guess)?
Also, can I just use __attribute__((noreturn))
? It should be identical semantically (unless noreturn
is #defined
), just shorter.
I think __attribute__((__noreturn__))
inline is preferable since it has the lowest chance of breaking with different C libraries/compilers/unexpected macro definitions.
_Noreturn
doesn't exist before C11, and is deprecated in C23 (in favor or[[noreturn]]
), so it's simpler just to use__attribute__((__noreturn__))
since we don't know what C version the headers will be compiled with.