[Toybox] [PATCH] macOS: noreturn.

enh enh at google.com
Thu Nov 29 15:01:00 PST 2018


On Wed, Nov 28, 2018 at 4:52 PM Rob Landley <rob at landley.net> wrote:
>
> On 11/28/18 5:41 PM, enh via Toybox wrote:
> > The macOS libc headers use `__attribute__((noreturn))` rather than
> > `__attribute__((__noreturn__))`, so toybox's `noreturn` macro trips them
> > up. Since we already have a variety of uses of `__attribute__` that
> > aren't guarded in this way, let's do the same here.
>
> It was for compilers that didn't have attribute(__noreturn__) (the kernel did
> this for really old gcc versions, and once upon a time I maintained a tinycc
> fork...) but it looks like C11 added some variant of it as standard:
>
> https://en.cppreference.com/w/c/language/_Noreturn
>
> And I guess C11 has hit the 7 year support horizon from the FAQ. (First thing
> I've found from C11 that might actually be worth depending on. Which would be a
> syntax migration but there's no rush, pretty sure this is not our only gcc
> extension and what's an interesting compiler that doesn't have those extensions?)

i'm happy to send you a patch switching over if you want, but one
thing to note is that i've found elsewhere that
__attribute__((__noreturn__)) and [[noreturn]] at least aren't quite
the same. the former can be used in places that the latter can't, and
i don't know whether that's a bug or by design. similar may be true of
_Noreturn.

(/me is still sad that you don't believe in C99 for loops...)

> Rob



More information about the Toybox mailing list