Skip to content

Commit c68eb22

Browse files
committed
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.
1 parent 03e17cb commit c68eb22

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/fundamental/macro-fundamental.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
/* SPDX-License-Identifier: LGPL-2.1-or-later */
22
#pragma once
33

4-
#if !SD_BOOT
5-
# include <assert.h>
6-
#endif
7-
84
#include <limits.h>
95
#include <stdalign.h>
106
#include <stdbool.h>
117
#include <stddef.h>
128
#include <stdint.h>
139

10+
/* This header unconditionally defines MAX() so include it here already so
11+
* it won't override our own definition of MAX() that we define later in this
12+
* file. */
13+
#if !SD_BOOT
14+
#include <sys/param.h>
15+
#endif
16+
1417
/* Temporarily disable some warnings */
1518
#define DISABLE_WARNING_DEPRECATED_DECLARATIONS \
1619
_Pragma("GCC diagnostic push"); \
@@ -144,11 +147,7 @@
144147
#define XCONCATENATE(x, y) x ## y
145148
#define CONCATENATE(x, y) XCONCATENATE(x, y)
146149

147-
#if SD_BOOT
148-
#define static_assert _Static_assert
149-
#endif
150-
151-
#define assert_cc(expr) static_assert(expr, #expr)
150+
#define assert_cc(expr) _Static_assert(expr, #expr)
152151

153152
#define UNIQ_T(x, uniq) CONCATENATE(__unique_prefix_, CONCATENATE(x, uniq))
154153
#define UNIQ __COUNTER__

0 commit comments

Comments
 (0)