[PATCH 5/5] gdb: change print format of flag enums with value 0

Simon Marchi simark@simark.ca
Tue Feb 18 20:52:00 GMT 2020


On 2020-02-18 3:45 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
> 
> Simon> gdb/ChangeLog:
> 
> Simon> 	* valprint.c (generic_val_print_enum_1): When printing a flag
> Simon> 	enum with value 0 and there is no enumerator with value 0, print
> Simon> 	just "0" instead of "(unknown: 0x0)".
> 
> This looks reasonable.  Thanks.
> 
> Simon>        /* We have a "flag" enum, so we try to decompose it into
> Simon>  	 pieces as appropriate.  A flag enum has disjoint
> Simon>  	 constants by definition.  */
> 
> I guess this comment is stale now, because an earlier patch changed it
> so that identical constants are allowed.

Right, I would then change this comment to this in patch 3/5:

 634       /* We have a "flag" enum, so we try to decompose it into pieces as
 635          appropriate.  The enum may have multiple enumerators representing
 636          the same bit, in which case we choose to only print the first one
 637          we find.  */

Simon



More information about the Gdb-patches mailing list