[PATCH 06/13] Installed header hygiene (BZ#20366): Macros used in #if without checking whether they are defined.

Zack Weinberg zackw@panix.com
Wed Sep 21 18:09:00 GMT 2016


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



More information about the Libc-alpha mailing list