Re: pr 11067 patch

Chris Moller
2010-02-11T14:19:23Z

On 02/11/10 04:29, Joel Brobecker wrote:
>> Provides a little more info on enums for simple 'p<enum>' cases;
>> keeps the old format for complex cases like structs and arrays:
>>
>
> I feel really bad about this, and I really apologize - I am just only
> suddenly wondering why this is considered a good idea, was that discussed?
> Please understand that this is not an objection, but I just had a look
> at the PR, and I happen to disagree with the reporter. According to me,
> he said:
>
> 1. If I print 'e', GDB prints 'Val1' and that's OK.
> 2. If I print 'Val1', GDB prints also prints 'Val1' and he says
> that, instead, GDB should print its numerical value.
>
> I disagree on (2) because, if he wanted the numerical value, he should
> have told GDB. For instance:
>
> (gdb) p GREEN
> $1 = GREEN
> (gdb) p /d GREEN
> $2 = 1
>
> If people still think that this suggestion is a good one, I looked at
> the patch (the least I could do)...
>

I personally don't have much of an opinion either way about whether the
patch is a good idea--it was on the bug list, they told me to shoot
bugs, so I did.

But for such a trivial thing, it sure has wasted a lot of bandwidth...

I'll fold in your comments below, thx.

>
>> +Wed Feb 10 17:13:44 2010 Chris Moller<moller@mollerware.com>
>> +
>> + PR gdb/11067
>> + * c-valprint.c (c_val_print): In case TYPE_CODE_ENUM, add code to
>> + print the numeric value of the enum and the enum tag for
>> + top-level, non-summary "print enum"s.
>>
>
>
>
>
>> + if (options->summary || recurse != 0)
>> + {
>> + fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
>> + }
>>
>
> We do not use the curly braces in this case, when the block only contains
> one statement.
>
>