mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
nss-systemd: work around -Werror=zero-as-null-pointer-constant issue with PTHREAD_MUTEX_INITIALIZER
This fixes builds on Fedora:
../src/nss-systemd/nss-systemd.c:105:18: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
105 | .mutex = PTHREAD_MUTEX_INITIALIZER,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
../src/nss-systemd/nss-systemd.c:105:18: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
../src/nss-systemd/nss-systemd.c:109:18: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
109 | .mutex = PTHREAD_MUTEX_INITIALIZER,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
../src/nss-systemd/nss-systemd.c:109:18: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
../src/nss-systemd/nss-systemd.c:113:18: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
113 | .mutex = PTHREAD_MUTEX_INITIALIZER,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
../src/nss-systemd/nss-systemd.c:113:18: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
../src/nss-systemd/nss-systemd.c:117:18: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
117 | .mutex = PTHREAD_MUTEX_INITIALIZER,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
../src/nss-systemd/nss-systemd.c:117:18: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
cc1: all warnings being treated as errors
This commit is contained in:
committed by
Yu Watanabe
parent
1d5f0a88e0
commit
83a3018e20
@@ -56,6 +56,10 @@
|
||||
_Pragma("GCC diagnostic push"); \
|
||||
_Pragma("GCC diagnostic ignored \"-Wzero-length-bounds\"")
|
||||
|
||||
#define DISABLE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT \
|
||||
_Pragma("GCC diagnostic push"); \
|
||||
_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
|
||||
|
||||
#define REENABLE_WARNING \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
|
||||
|
||||
@@ -101,6 +101,9 @@ typedef struct GetentData {
|
||||
bool by_membership;
|
||||
} GetentData;
|
||||
|
||||
/* On current glibc PTHREAD_MUTEX_INITIALIZER is defined in a way incompatible with
|
||||
* -Wzero-as-null-pointer-constant, work around this for now. */
|
||||
DISABLE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT;
|
||||
static GetentData getpwent_data = {
|
||||
.mutex = PTHREAD_MUTEX_INITIALIZER,
|
||||
};
|
||||
@@ -116,6 +119,7 @@ static GetentData getspent_data = {
|
||||
static GetentData getsgent_data = {
|
||||
.mutex = PTHREAD_MUTEX_INITIALIZER,
|
||||
};
|
||||
REENABLE_WARNING;
|
||||
|
||||
static void setup_logging_once(void) {
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
|
||||
Reference in New Issue
Block a user