OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: add nl(1)

From: Todd C. Miller (Todd.Millercourtesan.com)
Date: Wed May 15 2013 - 07:01:52 CDT


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.

 - todd