mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 1/3] envfs: fix defaultenv_append_directory macro definition
Date: Thu, 17 Aug 2023 09:39:39 +0200	[thread overview]
Message-ID: <20230817073941.1261154-1-a.fatoum@pengutronix.de> (raw)

defaultenv_append_directory is called as if it were a function and the
trailing semicolon can break parse of if-else statements. Wrap in do { }
while (0) to avoid this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/envfs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/envfs.h b/include/envfs.h
index d4e2c6110e65..abe0ffb96397 100644
--- a/include/envfs.h
+++ b/include/envfs.h
@@ -139,13 +139,13 @@ static inline int defaultenv_load(const char *dir, unsigned flags)
  * from the filename.
  */
 #define defaultenv_append_directory(name)			\
-	{							\
+	do {							\
 		extern char __bbenv_##name##_start[];		\
 		extern char __bbenv_##name##_end[];		\
 		defaultenv_append(__bbenv_##name##_start,	\
 				__bbenv_##name##_end -		\
 				__bbenv_##name##_start,		\
 				__stringify(name));		\
-	}
+	} while (0)
 
 #endif /* _ENVFS_H */
-- 
2.39.2




             reply	other threads:[~2023-08-17  7:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17  7:39 Ahmad Fatoum [this message]
2023-08-17  7:39 ` [PATCH master 2/3] test: arm: make multi_v8_defconfig.yaml a symlink to virt@ Ahmad Fatoum
2023-08-17  7:39 ` [PATCH master 3/3] sandbox: store stickypage in runtime dir Ahmad Fatoum
2023-08-17  9:33 ` [PATCH master 1/3] envfs: fix defaultenv_append_directory macro definition Marco Felsch
2023-08-18  6:00 ` Sascha Hauer

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=20230817073941.1261154-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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