Index: sys/sys/systm.h =================================================================== --- sys/sys/systm.h +++ sys/sys/systm.h @@ -47,6 +47,7 @@ #include #include /* for people using printf mainly */ +#ifdef _KERNEL __NULLABILITY_PRAGMA_PUSH extern int cold; /* nonzero if we are doing a cold boot */ @@ -97,8 +98,9 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2); #else #define kassert_panic panic -#endif -#endif +#endif /* KASSERT_PANIC_OPTIONAL */ +#endif /* defined(WITNESS) || defined(INVARIANT_SUPPORT) */ +#endif /* KERNEL */ #ifdef INVARIANTS /* The option is always available */ #define KASSERT(exp,msg) do { \ @@ -135,12 +137,6 @@ #define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") #endif -#if defined(_KERNEL) -#include /* MAXCPU */ -#include /* curthread */ -#include -#endif - /* * Helpful macros for quickly coming up with assertions with informative * panic messages. @@ -151,6 +147,18 @@ #define MPASS4(ex, what, file, line) \ KASSERT((ex), ("Assertion %s failed at %s:%d", what, file, line)) +/* + * Align variables. + */ +#define __read_mostly __section(".data.read_mostly") +#define __read_frequently __section(".data.read_frequently") +#define __exclusive_cache_line __aligned(CACHE_LINE_SIZE) \ + __section(".data.exclusive_cache_line") +#ifdef _KERNEL +#include /* MAXCPU */ +#include /* curthread */ +#include + /* * Assert that a pointer can be loaded from memory atomically. * @@ -180,13 +188,6 @@ }) #define SCHEDULER_STOPPED() SCHEDULER_STOPPED_TD(curthread) -/* - * Align variables. - */ -#define __read_mostly __section(".data.read_mostly") -#define __read_frequently __section(".data.read_frequently") -#define __exclusive_cache_line __aligned(CACHE_LINE_SIZE) \ - __section(".data.exclusive_cache_line") /* * XXX the hints declarations are even more misplaced than most declarations * in this file, since they are needed in one file (per arch) and only used @@ -629,4 +630,5 @@ __NULLABILITY_PRAGMA_POP +#endif #endif /* !_SYS_SYSTM_H_ */