fundamental: Always use _Static_assert for assert_cc()

Let's get rid of the assert.h include in macro-fundamental.h by always
using the builtin. Behavior is unchanged.
This commit is contained in:
Daan De Meyer
2025-04-18 14:19:13 +02:00
parent 03e17cbe6e
commit c68eb22064
+8 -9
View File
@@ -1,16 +1,19 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if !SD_BOOT
# include <assert.h>
#endif
#include <limits.h>
#include <stdalign.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
/* This header unconditionally defines MAX() so include it here already so
* it won't override our own definition of MAX() that we define later in this
* file. */
#if !SD_BOOT
#include <sys/param.h>
#endif
/* Temporarily disable some warnings */
#define DISABLE_WARNING_DEPRECATED_DECLARATIONS \
_Pragma("GCC diagnostic push"); \
@@ -144,11 +147,7 @@
#define XCONCATENATE(x, y) x ## y
#define CONCATENATE(x, y) XCONCATENATE(x, y)
#if SD_BOOT
#define static_assert _Static_assert
#endif
#define assert_cc(expr) static_assert(expr, #expr)
#define assert_cc(expr) _Static_assert(expr, #expr)
#define UNIQ_T(x, uniq) CONCATENATE(__unique_prefix_, CONCATENATE(x, uniq))
#define UNIQ __COUNTER__