summaryrefslogtreecommitdiff
path: root/src/boot/efi/util.h
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2023-01-07 22:16:52 +0100
committerLennart Poettering <lennart@poettering.net>2023-01-09 18:58:54 +0100
commit3f92dc2fd4070b213e6bc85263a9bef06ec9a486 (patch)
tree63f4106441053a06868aab1c5a5e6d13c42a4b4f /src/boot/efi/util.h
parentf977356a82822612d82a8b4507b5140a7a6ffc40 (diff)
downloadsystemd-3f92dc2fd4070b213e6bc85263a9bef06ec9a486.tar.gz
boot: Simplify object erasure
This erase_obj() machinery looks like voodoo and creates an awful lot of noise as soon as we get back to building with -O0. We can do this in a more simple way by introducing a struct that holds the information we need on cleanup. When building with optimization enabled, all this gets inlined and the eraser vanishes.
Diffstat (limited to 'src/boot/efi/util.h')
-rw-r--r--src/boot/efi/util.h25
1 files changed, 0 insertions, 25 deletions
diff --git a/src/boot/efi/util.h b/src/boot/efi/util.h
index cc750d7cca..836f223cc0 100644
--- a/src/boot/efi/util.h
+++ b/src/boot/efi/util.h
@@ -10,17 +10,6 @@
#define UINTN_MAX (~(UINTN)0)
#define INTN_MAX ((INTN)(UINTN_MAX>>1))
-#ifndef __has_attribute
-#define __has_attribute(x) 0
-#endif
-#if __has_attribute(__error__)
-__attribute__((noreturn)) extern void __assert_cl_failure__(void) __attribute__((__error__("compile-time assertion failed")));
-#else
-__attribute__((noreturn)) extern void __assert_cl_failure__(void);
-#endif
-/* assert_cl generates a later-stage compile-time assertion when constant folding occurs. */
-#define assert_cl(condition) ({ if (!(condition)) __assert_cl_failure__(); })
-
/* gnu-efi format specifiers for integers are fixed to either 64bit with 'l' and 32bit without a size prefix.
* We rely on %u/%d/%x to format regular ints, so ensure the size is what we expect. At the same time, we also
* need specifiers for (U)INTN which are native (pointer) sized. */
@@ -54,20 +43,6 @@ static inline void freep(void *p) {
#define _cleanup_free_ _cleanup_(freep)
-static __always_inline void erase_obj(void *p) {
-#ifdef __OPTIMIZE__
- size_t l;
- assert_cl(p);
- l = __builtin_object_size(p, 0);
- assert_cl(l != (size_t) -1);
- explicit_bzero_safe(p, l);
-#else
-#warning "Object will not be erased with -O0; do not release to production."
-#endif
-}
-
-#define _cleanup_erase_ _cleanup_(erase_obj)
-
_malloc_ _alloc_(1) _returns_nonnull_ _warn_unused_result_
static inline void *xmalloc(size_t size) {
void *p;