This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [Patch] Fix ONE_DIRECTION undef warnings.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Chris Metcalf <cmetcalf at tilera dot com>, Roland McGrath <roland at hack dot frob dot com>
- Cc: Steve Ellcey <sellcey at mips dot com>, libc-alpha at sourceware dot org
- Date: Wed, 30 Apr 2014 17:47:38 -0400
- Subject: Re: [Patch] Fix ONE_DIRECTION undef warnings.
- Authentication-results: sourceware.org; auth=none
- References: <c087928d-c0a6-4121-8236-84a1a9e59870 at BAMAIL02 dot ba dot imgtec dot org> <20140428174126 dot 18CE02C3A00 at topped-with-meat dot com> <535FFE81 dot 4060104 at redhat dot com> <1398802315 dot 14541 dot 48 dot camel at ubuntu-sellcey> <5360162B dot 90303 at redhat dot com> <1398877703 dot 5201 dot 10 dot camel at ubuntu-sellcey> <5361361F dot 3090304 at redhat dot com> <20140430175647 dot DC6392C39DE at topped-with-meat dot com> <53613A9F dot 1060701 at redhat dot com> <20140430181003 dot 8C5582C39D5 at topped-with-meat dot com> <53613EE5 dot 40300 at redhat dot com> <20140430200609 dot 999EB2C39F4 at topped-with-meat dot com> <536159B9 dot 5010906 at tilera dot com>
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.