From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>
Cc: Glenn Washburn <development@efficientek.com>
Subject: [PATCH] efi: Allow expression as func argument to efi_call_* macros on all platforms
Date: Tue, 21 Feb 2023 12:20:32 -0600 [thread overview]
Message-ID: <20230221182032.2214298-1-development@efficientek.com> (raw)
On EFI platforms where EFI calls do not require a wrapper (notably i386-efi
and arm64-efi), the func argument needs to be wrapped in parenthesis to
allow valid syntax when func is an expression which evaluates to a function
pointer. On EFI platforms that do need a wrapper, this was never an issue
because func is passed to the C function wrapper as an argument and thus
does not need parenthesis to be evaluated.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
This is not needed by the current GRUB code base. However, it is needed by
some local modifications I've made. Regardless, I think this makes the official
source better.
Glenn
---
include/grub/efi/api.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index ad2680341b..b4c4646651 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1799,15 +1799,15 @@ typedef struct initrd_media_device_path initrd_media_device_path_t;
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|| defined(__riscv)
-#define efi_call_0(func) func()
-#define efi_call_1(func, a) func(a)
-#define efi_call_2(func, a, b) func(a, b)
-#define efi_call_3(func, a, b, c) func(a, b, c)
-#define efi_call_4(func, a, b, c, d) func(a, b, c, d)
-#define efi_call_5(func, a, b, c, d, e) func(a, b, c, d, e)
-#define efi_call_6(func, a, b, c, d, e, f) func(a, b, c, d, e, f)
-#define efi_call_7(func, a, b, c, d, e, f, g) func(a, b, c, d, e, f, g)
-#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) func(a, b, c, d, e, f, g, h, i, j)
+#define efi_call_0(func) (func)()
+#define efi_call_1(func, a) (func)(a)
+#define efi_call_2(func, a, b) (func)(a, b)
+#define efi_call_3(func, a, b, c) (func)(a, b, c)
+#define efi_call_4(func, a, b, c, d) (func)(a, b, c, d)
+#define efi_call_5(func, a, b, c, d, e) (func)(a, b, c, d, e)
+#define efi_call_6(func, a, b, c, d, e, f) (func)(a, b, c, d, e, f)
+#define efi_call_7(func, a, b, c, d, e, f, g) (func)(a, b, c, d, e, f, g)
+#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) (func)(a, b, c, d, e, f, g, h, i, j)
#else
--
2.34.1
next reply other threads:[~2023-02-21 18:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 18:20 Glenn Washburn [this message]
2023-02-23 14:14 ` [PATCH] efi: Allow expression as func argument to efi_call_* macros on all platforms Daniel Kiper
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=20230221182032.2214298-1-development@efficientek.com \
--to=development@efficientek.com \
--cc=dkiper@net-space.pl \
--cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.