summaryrefslogtreecommitdiff
path: root/src/fundamental/macro-fundamental.h
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2022-06-24 10:45:52 +0200
committerJan Janssen <medhefgo@web.de>2022-06-27 12:16:27 +0200
commit6b852d22b621ef37ef67a3b24ca1f075e0b78698 (patch)
tree7f4b759f1cd91d45e36f9e9329bef006b5483e5a /src/fundamental/macro-fundamental.h
parentaec2f54b30f58394f8f67d7e1c56ee3d7ca91eed (diff)
downloadsystemd-6b852d22b621ef37ef67a3b24ca1f075e0b78698.tar.gz
fundamental: Remove types-fundamental.h
This removes the fundamental typedefs in favor of just using standard C types. These are all used internally anyway and also do not do anything special to warrant any redefinition to EFI types. Even for BOOLEAN we can safely use stdbool. The defition from the EFI specification is fully compatible, including making any other values than 0/1 as undefined. The exception is sd_char as those need to be char16_t. The typedef is moved to string-util-fundamental.h instead.
Diffstat (limited to 'src/fundamental/macro-fundamental.h')
-rw-r--r--src/fundamental/macro-fundamental.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h
index 18370ac46a..3c38afcab8 100644
--- a/src/fundamental/macro-fundamental.h
+++ b/src/fundamental/macro-fundamental.h
@@ -3,11 +3,12 @@
#ifndef SD_BOOT
# include <assert.h>
-# include <stddef.h>
#endif
#include <limits.h>
-#include "types-fundamental.h"
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
#define _align_(x) __attribute__((__aligned__(x)))
#define _alignas_(x) __attribute__((__aligned__(__alignof__(x))))
@@ -105,10 +106,10 @@
* on this macro will run concurrently to all other code conditionalized
* the same way, there's no ordering or completion enforced. */
#define ONCE __ONCE(UNIQ_T(_once_, UNIQ))
-#define __ONCE(o) \
- ({ \
- static sd_bool (o) = sd_false; \
- __sync_bool_compare_and_swap(&(o), sd_false, sd_true); \
+#define __ONCE(o) \
+ ({ \
+ static bool (o) = false; \
+ __sync_bool_compare_and_swap(&(o), false, true); \
})
#undef MAX
@@ -258,7 +259,7 @@
#define IN_SET(x, ...) \
({ \
- sd_bool _found = sd_false; \
+ bool _found = false; \
/* If the build breaks in the line below, you need to extend the case macros. (We use "long double" as \
* type for the array, in the hope that checkers such as ubsan don't complain that the initializers for \
* the array are not representable by the base type. Ideally we'd use typeof(x) as base type, but that \
@@ -267,7 +268,7 @@
assert_cc(ELEMENTSOF(__assert_in_set) <= 20); \
switch (x) { \
FOR_EACH_MAKE_CASE(__VA_ARGS__) \
- _found = sd_true; \
+ _found = true; \
break; \
default: \
break; \
@@ -299,9 +300,6 @@
})
static inline size_t ALIGN_TO(size_t l, size_t ali) {
- /* sd-boot uses UINTN for size_t, let's make sure SIZE_MAX is correct. */
- assert_cc(SIZE_MAX == ~(size_t)0);
-
/* Check that alignment is exponent of 2 */
#if SIZE_MAX == UINT_MAX
assert(__builtin_popcount(ali) == 1);