about summary refs log tree commit diff
path: root/shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-07-31 10:51:42 +0200
committerMichael Biebl <biebl@debian.org>2019-07-31 10:51:42 +0200
commit2e5fa45ddfbb5cffa1e78221f1cea706e2f298af (patch)
tree86f69d36c56de3074280456eddc854a780b8e04b /shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h
parent85563b7fc7ec2cd21e38debb9b28db342e2e8e7c (diff)
New upstream version 1.19.90 upstream/1.19.90
Diffstat (limited to 'shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h')
-rw-r--r--shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h38
1 files changed, 20 insertions, 18 deletions
diff --git a/shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h b/shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h
index a285c3cd..8dd93341 100644
--- a/shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h
+++ b/shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
@@ -21,8 +20,6 @@
 
 #include "nm-default.h"
 
-#include <syslog.h>
-
 #include "nm-glib-aux/nm-logging-fwd.h"
 
 /*****************************************************************************/
@@ -32,32 +29,29 @@
 
 /*****************************************************************************/
 
-static inline NMLogLevel
-_slog_level_to_nm (int slevel)
-{
-	switch (LOG_PRI (slevel)) {
-	case LOG_DEBUG:   return LOGL_DEBUG;
-	case LOG_WARNING: return LOGL_WARN;
-	case LOG_CRIT:
-	case LOG_ERR:     return LOGL_ERR;
-	case LOG_INFO:
-	case LOG_NOTICE:
-	default:          return LOGL_INFO;
-	}
-}
+/* systemd detects whether compiler supports "-Wstringop-truncation" to disable
+ * the warning at particular places. Since we anyway build with -Wno-pragma,
+ * we don't do that and just let systemd call
+ *
+ *   _Pragma("GCC diagnostic ignored \"-Wstringop-truncation\"")
+ *
+ * regadless whether that would result in a -Wpragma warning. */
+#define HAVE_WSTRINGOP_TRUNCATION 1
+
+/*****************************************************************************/
 
 static inline int
 _nm_log_get_max_level_realm (void)
 {
 	/* inline function, to avoid coverity warning about constant expression. */
-	return LOG_DEBUG;
+	return 7 /* LOG_DEBUG */;
 }
 #define log_get_max_level_realm(realm) _nm_log_get_max_level_realm ()
 
 #define log_internal_realm(level, error, file, line, func, format, ...) \
 ({ \
 	const int _nm_e = (error); \
-	const NMLogLevel _nm_l = _slog_level_to_nm ((level)); \
+	const NMLogLevel _nm_l = nm_log_level_from_syslog (LOG_PRI (level)); \
 	\
 	if (_nm_log_enabled_impl (!(NM_THREAD_SAFE_ON_MAIN_THREAD), _nm_l, LOGD_SYSTEMD)) { \
 		const char *_nm_location = strrchr ((""file), '/'); \
@@ -102,6 +96,14 @@ G_STMT_START { \
 #include <sys/syscall.h>
 #include <sys/ioctl.h>
 
+/*****************************************************************************/
+
+/* systemd cannot be compiled with "-Wdeclaration-after-statement". In particular
+ * in combintation with assert_cc(). */
+NM_PRAGMA_WARNING_DISABLE ("-Wdeclaration-after-statement")
+
+/*****************************************************************************/
+
 static inline pid_t
 raw_getpid (void) {
 #if defined(__alpha__)