Date: Tue, 05 Aug 2003 16:16:17 +0300 From: Diomidis Spinellis <dds@aueb.gr> To: Johan Karlsson <johan@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/sym sym_fw.h Message-ID: <3F2FAE21.6EEB6309@aueb.gr> References: <200308050722.h757MCxl098780@repoman.freebsd.org> <20030805122815.GA17099@numeri.campus.luth.se>
next in thread | previous in thread | raw e-mail | index | archive | help
Johan Karlsson wrote:
> On Tue, Aug 05, 2003 at 00:22 (-0700) +0000, Diomidis Spinellis wrote:
> > dds 2003/08/05 00:22:12 PDT
> >
> > FreeBSD src repository
> >
> > Modified files:
> > sys/dev/sym sym_fw.h
> > Log:
> > Remove extraneous semicolons. They are already provided by
> > the macro definition, and cause the generation of syntactically
> > incorrect code that gcc happens to accept.
>
> This is backwards.
>
> >From style(9):
> Any final statement-ter-
> minating semicolon should be supplied by the macro invocation rather than
> the macro, to make parsing easier for pretty-printers and editors.
>
> Please consider reverting this and change the macros in the file to not
> supply the terminating semicolon.
I would certainly follow the style(9) guide if the existing code allowed
it. This case is however more complicated. The same two 15-line macros
(SYM_GEN_FW_[AB]) are used to specify structure member declarations and
initializations:
#define SYM_GEN_FW_B(s) \
SYM_GEN_B(s, no_data) \
SYM_GEN_B(s, sel_for_abort) \
SYM_GEN_B(s, sel_for_abort_1) \
...
SYM_GEN_B is defined as
#define SYM_GEN_B(s, label) s label;
in the include file for defining the structure members, and as
#define SYM_GEN_B(s, label) ((short) offsetof(s, label)),
in the C file for initializing the structures. Thus SYM_GEN_FW will
always end with a semicolon or a comma. Also note that the terminator
can not be specified as a macro argument. The two macros could be
duplicated in semicolon-terminating and comma-separating versions (with
the last separating/terminating element missing), but I believe this
would be worse than the style rule violation. Other ideas welcome.
Diomidis - dds@
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F2FAE21.6EEB6309>
