"Todd C. Miller" <todd.mil...@courtesan.com> writes:

> On Fri, 10 May 2013 23:58:23 +0200, 
> =?utf-8?Q?J=C3=A9r=C3=A9mie_Courr=C3=A8ges-
> Anglas?= wrote:
>
>> > +          switch (numbering_properties[section].type) {
>> > +          case number_all:
>> > +                  /*
>> > +                   * Doing this for number_all only is disputable, but
>> > +                   * the standard expresses an explicit dependency on
>> > +                   * `-b a' etc.
>> > +                   */
>> > +                  if (buffer[0] == '\n' && ++adjblank < nblank)
>> > +                          donumber = 0;
>> > +                  else
>> > +                          donumber = 1, adjblank = 0;
>> > +                  break;
>> > +          case number_nonempty:
>> > +                  donumber = (buffer[0] != '\n');
>> > +                  break;
>> > +          case number_none:
>> > +                  donumber = 0;
>> > +                  break;
>> > +          case number_regex:
>> > +                  donumber =
>> > +                      (regexec(&numbering_properties[section].expr,
>> > +                      buffer, 0, NULL, 0) == 0);
>> > +                  break;
>> 
>> What about a default case here, to make WARNINGS=Yes shut up?
>
> I think that would be a mistake.  All the possible enum values are
> already listed in the switch.  Omitting a default: label allows the
> compiler to warn when a new value is added to the enum that is not
> handled by the switch.

Indeed, I hadn't thought about this.

>  - todd

-- 
Jérémie Courrèges-Anglas
PGP Key fingerprint: 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494

Reply via email to