[Patch] Fix ONE_DIRECTION undef warnings.
Carlos O'Donell
carlos@redhat.com
Wed Apr 30 21:47:00 GMT 2014
On 04/30/2014 04:14 PM, Chris Metcalf wrote:
> On 4/30/2014 4:06 PM, Roland McGrath wrote:
>>> That sounds like you're against the default header design. Could you clarify
>>> your position on that?
>> I am against anything that is prone to typos introducing silent errors when
>> we can come up with an alternative solution that is not a worse maintenance
>> burden in other regards. That is an abstract position and that's all I
>> have because I don't have a specific alternative proposal for
>> iconv/skeleton.c at the moment. I'm hoping to encourage other folks like
>> you to explore new alternatives that might satisfy my constraints better
>> than what we've discussed so far.
>
> In the <arch/chip.h> header for the Tilera architectures we provide
> macros defining characteristics of the chip like this:
>
> /** Does the chip have an IPI shim? */
> #define CHIP_HAS_IPI() 1
>
> This requires code that uses it to do
>
> #if CHIP_HAS_IPI()
> ...
> #endif
>
> Typos then generate a cryptic but uniformly fatal error: missing
> binary operator before token "(". The style is aesthetically a bit
> awkward, but we've become used to it :-)
It still doesn't solve the typo in the overriding implementation
providing the wrong override e.g.
#undef CHIP_HAS_1PI() 1
#define CHIP_HAS_1PI() 0
#if CHIP_HAS_IPI()
...
#endif
You would still get the default for CHIP_HAS_IPI of 1.
If there was no default you would get an error as you suggest.
Cheers,
Carlos.
More information about the Libc-alpha
mailing list