This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Wrap a macro in do {} while (0) (PR sanitizer/80063)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 20 Mar 2017 14:41:08 +0100
- Subject: Re: [PATCH] Wrap a macro in do {} while (0) (PR sanitizer/80063)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com ED03C19D22F
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com ED03C19D22F
- References: <20170320132802.GH3172@redhat.com> <CADzB+2mZMVUNH1LWUtJcnPmoS9om7_4Whuk0OhFLxTj=gkeYxQ@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Mar 20, 2017 at 09:37:10AM -0400, Jason Merrill wrote:
> On Mon, Mar 20, 2017 at 9:28 AM, Marek Polacek <polacek@redhat.com> wrote:
> > #define DEF_SANITIZER_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
> > + do { \
> > + decl = add_builtin_function ("__builtin_" NAME, TYPE, ENUM, \
> > + BUILT_IN_NORMAL, NAME, NULL_TREE); \
> > + set_call_expr_flags (decl, ATTRS); \
> > + set_builtin_decl (ENUM, decl, true); \
> > + } while (0);
>
> We leave out the trailing ; in a macro like this.
If we only use them for code, sure. But DEF_*BUILTIN is used also to
define the names, enum values etc. where it needs other separators, so
*.def files don't put any separator after the closing ).
Jakub