Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Aug 2003 01:03:58 +0300
From:      Diomidis Spinellis <dds@aueb.gr>
To:        Dag-Erling =?iso-8859-7?Q?Sm=F8rgrav?= <des@des.no>
Cc:        Johan Karlsson <johan@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/dev/sym sym_fw.h
Message-ID:  <3F3029CE.40C6746B@aueb.gr>
References:  <200308050722.h757MCxl098780@repoman.freebsd.org> <20030805122815.GA17099@numeri.campus.luth.se> <3F2FAE21.6EEB6309@aueb.gr> <xzp8yq7ao2r.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
Dag-Erling Sm=F8rgrav wrote:
> Diomidis Spinellis <dds@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)               \
=2E..

// 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@




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F3029CE.40C6746B>