mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
basic/include: replace _Static_assert() with static_assert()
If one of the header is included in a C++ source file, then using _Static_assert() triggers compile error for some reasons. Let's use static_assert(), which can be used by both C and C++ code.
This commit is contained in:
@@ -8,19 +8,21 @@
|
||||
|
||||
#include_next <sched.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/* 769071ac9f20b6a447410c7eaa55d1a5233ef40c (5.8),
|
||||
* defined in sched.h since glibc-2.36. */
|
||||
#ifndef CLONE_NEWTIME
|
||||
# define CLONE_NEWTIME 0x00000080
|
||||
#else
|
||||
_Static_assert(CLONE_NEWTIME == 0x00000080, "");
|
||||
static_assert(CLONE_NEWTIME == 0x00000080, "");
|
||||
#endif
|
||||
|
||||
/* Not exposed yet. Defined at include/linux/sched.h */
|
||||
#ifndef PF_KTHREAD
|
||||
# define PF_KTHREAD 0x00200000
|
||||
#else
|
||||
_Static_assert(PF_KTHREAD == 0x00200000, "");
|
||||
static_assert(PF_KTHREAD == 0x00200000, "");
|
||||
#endif
|
||||
|
||||
/* The maximum thread/process name length including trailing NUL byte. This mimics the kernel definition of
|
||||
@@ -31,5 +33,5 @@ _Static_assert(PF_KTHREAD == 0x00200000, "");
|
||||
#ifndef TASK_COMM_LEN
|
||||
# define TASK_COMM_LEN 16
|
||||
#else
|
||||
_Static_assert(TASK_COMM_LEN == 16, "");
|
||||
static_assert(TASK_COMM_LEN == 16, "");
|
||||
#endif
|
||||
|
||||
@@ -3,16 +3,18 @@
|
||||
|
||||
#include_next <sys/mman.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/* since glibc-2.38 */
|
||||
#ifndef MFD_NOEXEC_SEAL
|
||||
# define MFD_NOEXEC_SEAL 0x0008U
|
||||
#else
|
||||
_Static_assert(MFD_NOEXEC_SEAL == 0x0008U, "");
|
||||
static_assert(MFD_NOEXEC_SEAL == 0x0008U, "");
|
||||
#endif
|
||||
|
||||
/* since glibc-2.38 */
|
||||
#ifndef MFD_EXEC
|
||||
# define MFD_EXEC 0x0010U
|
||||
#else
|
||||
_Static_assert(MFD_EXEC == 0x0010U, "");
|
||||
static_assert(MFD_EXEC == 0x0010U, "");
|
||||
#endif
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
|
||||
#include_next <sys/random.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/* Defined since glibc-2.32. */
|
||||
#ifndef GRND_INSECURE
|
||||
# define GRND_INSECURE 0x0004
|
||||
#else
|
||||
_Static_assert(GRND_INSECURE == 0x0004, "");
|
||||
static_assert(GRND_INSECURE == 0x0004, "");
|
||||
#endif
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
|
||||
#include_next <sys/wait.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/* since glibc-2.36 */
|
||||
#ifndef P_PIDFD
|
||||
# define P_PIDFD 3
|
||||
#else
|
||||
_Static_assert(P_PIDFD == 3, "");
|
||||
static_assert(P_PIDFD == 3, "");
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user