This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 06/13] Installed header hygiene (BZ#20366): Macros used in #if without checking whether they are defined.
- From: Zack Weinberg <zackw at panix dot com>
- To: "Carlos O'Donell" <carlos at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, Joseph Myers <joseph at codesourcery dot com>
- Date: Wed, 21 Sep 2016 14:08:56 -0400
- Subject: Re: [PATCH 06/13] Installed header hygiene (BZ#20366): Macros used in #if without checking whether they are defined.
- Authentication-results: sourceware.org; auth=none
- References: <20160830011645.25769-1-zackw@panix.com> <20160830011645.25769-2-zackw@panix.com> <20160830011645.25769-3-zackw@panix.com> <20160830011645.25769-4-zackw@panix.com> <20160830011645.25769-5-zackw@panix.com> <20160830011645.25769-6-zackw@panix.com> <20160830011645.25769-7-zackw@panix.com> <670d128e-b21a-b26c-8c5f-bc64bf68527e@redhat.com>
On Wed, Sep 21, 2016 at 2:02 PM, Carlos O'Donell <carlos@redhat.com> wrote:
>> * misc/sys/cdefs.h: Tidy up conditional nest defining __flexarr.
>> Define __flexarr_is_fake when the compiler does not support
>> flexible array members.
>
> This patch fails to follow the Macro API best practice that all macros
> be defined and that we should check for their values not their defined-ness
> which can introduce subtle errors e.g. __flexarr_is_fake.
Doh, I should have remembered that. I think I'll also flip the sense
and call it __glibc_c99_flexarr_available. It's a bit of a mouthful
but it makes for a clearer test at the point of use.
> At a high level I would expect _LIBC to always be defined as either 0 or 1.
My expectation is actually that it is either undefined or 1, for
historical reasons, but I wouldn't want to swear that it never gets
defined to be 0.
zw