]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fundamental: support assert_se() in EFI mode too
authorLennart Poettering <lennart@poettering.net>
Tue, 1 Feb 2022 14:28:19 +0000 (15:28 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 1 Feb 2022 14:29:21 +0000 (15:29 +0100)
src/boot/efi/assert.c
src/fundamental/macro-fundamental.h

index 7a25526de2f0403e17e3bacaf8bd09a70669e9a2..bb16d2bf9328f76745b32e0750872904a2af6b60 100644 (file)
@@ -1,9 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#ifndef NDEBUG
-
 #include <efi.h>
 #include <efilib.h>
+
 #include "util.h"
 
 void efi_assert(const char *expr, const char *file, unsigned line, const char *function) {
@@ -11,5 +10,3 @@ void efi_assert(const char *expr, const char *file, unsigned line, const char *f
         for (;;)
                 BS->Stall(60 * 1000 * 1000);
 }
-
-#endif
index d597c743bbb229b20c37a78f79d9812ad57fcc25..a1cbc3a5b3b26f5d1f84f3aa743e545d7c9ffa54 100644 (file)
 #define CONCATENATE(x, y) XCONCATENATE(x, y)
 
 #ifdef SD_BOOT
+        void efi_assert(const char *expr, const char *file, unsigned line, const char *function) _noreturn_;
+
         #ifdef NDEBUG
                 #define assert(expr)
                 #define assert_not_reached() __builtin_unreachable()
         #else
-                void efi_assert(const char *expr, const char *file, unsigned line, const char *function) _noreturn_;
                 #define assert(expr) ({ _likely_(expr) ? VOID_0 : efi_assert(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); })
                 #define assert_not_reached() efi_assert("Code should not be reached", __FILE__, __LINE__, __PRETTY_FUNCTION__)
         #endif
+        #define assert_se(expr) ({ _likely_(expr) ? VOID_0 : efi_assert(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); })
 
         #define memcpy(a, b, c) CopyMem((a), (b), (c))
         #define free(a) FreePool(a)