This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: STRING_COMMA_LEN
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> On Wed, 24 Oct 2007, Andreas Schwab wrote:
>
>> Daniel Jacobowitz <drow@false.org> writes:
>>
>> > We got a report (gdb/2339) that GDB 6.7 doesn't build with the Sun
>> > compiler.
>> >
>> > "elf.c", line 856: non-constant initializer: op "?"
>> > "elf.c", line 859: non-constant initializer: op "?"
>> > "elf.c", line 864: non-constant initializer: op "?"
>> > "elf.c", line 871: non-constant initializer: op "?"
>> >
>> > That's a STRING_COMMA_LEN:
>> >
>> > #define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0)
>> >
>> > I don't know if this is pedantically correct C or not; just
>> > passing it along...
>>
>> The compiler is broken, conditional expressions are explicitly allowed
>> in constant expressions. Of course, I don't know if the Sun compiler
>> claims standards conformance in any way...
>
> The problem with that would seem to be to be the use of the string
> literal, not the conditional expression as the Sun compiler claims.
You are right, of course. I think we should just remove the NULL check
and fix the few cases that use this feature (only in ld/pe-dll.c).
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."