From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
To: "Nick Desaulniers" <ndesaulniers@google.com>,
"Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: boris.brezillon@collabora.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
daniel@ffwll.ch, trix@redhat.com,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, naresh.kamboju@linaro.org, dakr@redhat.com
Subject: Re: [PATCH 1/2] drm/exec: use unique instead of local label
Date: Thu, 10 Aug 2023 10:29:51 +0200 [thread overview]
Message-ID: <a2ba37f2-d498-6958-eb96-5bbfc8b2151c@prevas.dk> (raw)
In-Reply-To: <CAKwvOdmRm=vOjNXGWeuKw-h78CXMrkcwc5vnCRVqFxMxWzhCcg@mail.gmail.com>
On 01/08/2023 22.35, Nick Desaulniers wrote:
> I suspect it's possible to change the indirect goto into a direct goto
> with some further refactoring (macros can take block statements;
Well, with some somewhat subtle restrictions. C99, 6.10.3.11. "The
sequence of preprocessing tokens bounded by the outside-most matching
parentheses forms the list of arguments for the function-like macro. The
individual arguments within the list are separated by comma
preprocessing tokens, but comma preprocessing tokens between matching
inner parentheses do not separate arguments."
cpp doesn't care about the {} tokens when trying to figure out what
constitutes the "block" argument, so if that block contained any comma
outside a () pair, cpp would barf something like
error: macro "foo" passed 3 arguments, but takes just 2
So while the commas inside function calls (and other macro invocations)
are fine, constructs like
int x, y;
or
struct s s = {.a = 3, .b = 4}
would be verboten inside that block.
One way around that is to make block a variadic argument so it just
gobbles up all preprocessor token. Or have the users pass a statement
expression instead of a block.
Rasmus
next prev parent reply other threads:[~2023-08-10 8:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 12:36 Christian König
2023-07-31 12:36 ` [PATCH 2/2] drm/exec: add test case for using a drm_exec multiple times Christian König
2023-07-31 15:31 ` [PATCH 1/2] drm/exec: use unique instead of local label Nathan Chancellor
2023-07-31 16:00 ` Boris Brezillon
2023-08-01 20:35 ` Nick Desaulniers
2023-08-02 8:44 ` Boris Brezillon
2023-08-02 21:24 ` Nick Desaulniers
2023-08-10 8:29 ` Rasmus Villemoes [this message]
2023-08-09 15:37 ` Nathan Chancellor
2023-08-10 6:40 ` Boris Brezillon
2023-08-10 6:48 ` Christian König
2023-08-10 14:38 ` Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a2ba37f2-d498-6958-eb96-5bbfc8b2151c@prevas.dk \
--to=rasmus.villemoes@prevas.dk \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dakr@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=naresh.kamboju@linaro.org \
--cc=ndesaulniers@google.com \
--cc=trix@redhat.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®