This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Correct __GNUC_PREREQ for __const__ and __noreturn__ attributes.
On Thu, Mar 23, 2017 at 1:32 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Tue, 21 Mar 2017, Paul Eggert wrote:
>
>> For what it's worth, Gnulib code uses __attribute__ ((__noreturn__)) for GCC
>> 2.8 and later, and __attribute__ ((__const__)) for GCC 2.95 and later. I
>> vaguely recall problems using these attributes in earlier GCC versions, though
>> I'm afraid I don't remember the details. Perhaps Glibc wouldn't run into the
>> problems, whatever they were.
>
> I think the 2.8 conditional may be in order to support it at the start of
> a function declaration (before the return type), i.e. compatibly with
> _Noreturn.
So I took some time and tested the __attribute__ syntax in gcc 2.7.2
(in the old Debian 1.1) and a custom-built gcc 2.8.0 (not fully
bootstrapped but enough to compile test code).
And yes you're correct; the prefix attribute syntax doesn't work until
2.8.0.
Thanks both Paul Eggert and Joseph Myers.
(By the way, should we add a comment about this info in the code?)