[PATCH] Add a few noreturn keywords
Joseph S. Myers
joseph@codesourcery.com
Mon Jan 23 22:03:00 GMT 2012
On Tue, 10 Jan 2012, Ulrich Drepper wrote:
> > BTW, wouldn't it be better to define `attribute_noreturn' which could
> > under C11 expand to _Noreturn keyword, otherwise to
> > __attribute__ ((noreturn))? Thanks,
>
> Completely irrelevant for all the internal prototypes. gcc will
> always be required.
>
> For the ones in installed headers I see a problem with the placement.
> Unless all gcc versions are guaranteed to allow the attribute to be
> added in the same place as _Noreturn is required there will be no
> change.
The following prefix form is the most natural one for use with _Noreturn,
but only works with GCC 2.8 and later (including EGCS 1.0 and 1.1), not
2.7:
__attribute__((__noreturn__)) void nrf1 (void);
The following form, with the attribute after the return type, which is
also valid for _Noreturn, works with 2.7 and later:
void __attribute__((__noreturn__)) nrf1 (void);
This was tested with 2.7.2.3 (2.7.2.x were the earliest versions to
support glibc 2.x with the Linux kernel) and later versions (latest
version from each release series). It appears that prefix attributes were
first supported at all in 2.7. I don't think versions before 2.7 are
relevant for using glibc's headers, however (except maybe for the versions
of any headers that are also used in gnulib), given that they do not
support a configuration for glibc 2.x with the Linux kernel (only libc4
and libc5) and their GNU HURD configuration also looks like an a.out
configuration incompatible with current glibc - so there is empty
intersection between the configurations supported by current glibc and
those supported by GCC 2.6 and before.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list