cvs commit: src/sys/dev/sym sym_fw.h

Diomidis Spinellis dds at aueb.gr
Tue Aug 5 15:26:12 PDT 2003


Dag-Erling Smψrgrav wrote:
> Diomidis Spinellis <dds at aueb.gr> writes:
> > 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.
> 
> Remove the semicolon and the comma from the definitions, and add
> semicolons and commas to the invocations.

As I wrote, this will not work, because there we are dealing with two
different nested macro definitions.  Consider the main macro definition
D1 and the two alternative nested macros D2 and D3:

// D1: 
#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)               \
...

// D2:
#define SYM_GEN_B(s, label)     s label;

// D3:
#define SYM_GEN_B(s, label)     ((short) offsetof(s, label)),

Removing the semicolon from D2 or the comma from D3 will make D1
syntactically incorrect.

Diomidis -- dds@




More information about the cvs-src mailing list