From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pUXG8-0007kv-9J for mharc-grub-devel@gnu.org; Tue, 21 Feb 2023 13:21:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUXG7-0007ju-1H for grub-devel@gnu.org; Tue, 21 Feb 2023 13:20:59 -0500 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUXG5-0002ZG-3P for grub-devel@gnu.org; Tue, 21 Feb 2023 13:20:58 -0500 Received: by mail-qt1-x835.google.com with SMTP id fp16so5193970qtb.10 for ; Tue, 21 Feb 2023 10:20:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cwY/Rbi71RdBOP1V+7J9SWnm4S2PexQU8P9jz5LSmuQ=; b=d3gVK65yv/CtX6jfrb0Wj2E8WjbetH0zi4SUkQVJgzLWLXs8BnwMEAboAiM5W5lFgN zE+jrYf76uZoywPbRlEXjEa1Zbw1mcua06uS35ec61Z9i3nT0wr0MQWVe/T8ecBVDWT9 kLAGXf0VBsa7ZPV1+EtsLvImxMxuXBXbxU9cmnVdd1zY5ty8YXVW2Jy2KkIKiIMD4LT0 eXRHGkWqL0eF1rvYGv/ez+0FB/HORu7cQbctBwCkfEnXPcYfELVeBOGRBF/NG0JFVtim taWv+2tU9SBOKZuFhDDHGYwwWuisgx/lLJh/DQq68MzQlkIqYVbtm2JOXmgR641cjThu GkAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cwY/Rbi71RdBOP1V+7J9SWnm4S2PexQU8P9jz5LSmuQ=; b=N3XfdJ1GAJJoVpk7BSkvy+Jzjrv88FD9hksW4AKlr1j+/xySnryjLXHF8yH+DglI9G 1MzDnHYaGngsOC1tv2lNO873XgnHkCv0HEfiDu5BSYeAuMqazU90Y8G3h7mXFfmiaDlI P2udHhO5WMtJLOUiQEP8wSWzjacDJfeHIedsma8VPwulk/MUutEgRqPN2Mzw6DbObQZ1 jOUWOomyXN1GmDWdDlt6oh7pUKZW2ELE70+2/oAhwNaDh5Bmtd2fT1B5OCVCd7RiLm0b GtrkXKAPMiz1Dgs/p85EbbTxpcX+VRCo/cVSiSuMvmQ2Ihj81THl0NeQcqS5R/QVE5VD 1sRA== X-Gm-Message-State: AO0yUKVMZBY042VSwmARJnqQI/ig34NRffyZaQzrK4ouisvFmFA0hZbQ 8ZYMcotEVSOoymlujrmi1EXSwDVYP1AjNuQw X-Google-Smtp-Source: AK7set8VUnPUdPTWZ3rl8bcOH7xdh6yOE+e0jCvxDEUHNOYtSVsvwTi4tKS5KmceqcS/1GNp3b/h4Q== X-Received: by 2002:a05:622a:1481:b0:3b9:b6b7:90c5 with SMTP id t1-20020a05622a148100b003b9b6b790c5mr7652914qtx.49.1677003653189; Tue, 21 Feb 2023 10:20:53 -0800 (PST) Received: from localhost.localdomain ([37.218.244.251]) by smtp.gmail.com with ESMTPSA id 13-20020a37070d000000b007419eb86df0sm1675666qkh.127.2023.02.21.10.20.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 10:20:52 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Glenn Washburn Subject: [PATCH] efi: Allow expression as func argument to efi_call_* macros on all platforms Date: Tue, 21 Feb 2023 12:20:32 -0600 Message-Id: <20230221182032.2214298-1-development@efficientek.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::835; envelope-from=development@efficientek.com; helo=mail-qt1-x835.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2023 18:20:59 -0000 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 --- 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