summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-01-25 21:42:37 +0100
committerThomas Haller <thaller@redhat.com>2015-01-26 16:30:27 +0100
commit670eb57321afabf3cc81a260200133078e295860 (patch)
treea4041b719a043245c7e58ad5fbd619467ad5b466
parent11b95628982a3cf445e9a2a00874737723e6788f (diff)
downloadNetworkManager-670eb57321afabf3cc81a260200133078e295860.tar.gz
logging: assert that NMLogDomains compiles to a 64 bit enum
Enum types larger then the native 'int' type are undefined behavior according to C standard. Assert that our compiler does the right thing. the expression that defines the value of an enumeration constant shall be an integer constant expression that has a value representable as an int
-rw-r--r--src/nm-logging.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nm-logging.c b/src/nm-logging.c
index f1291fa73b..7f2170ca39 100644
--- a/src/nm-logging.c
+++ b/src/nm-logging.c
@@ -104,6 +104,9 @@ static const LogDesc domain_descs[] = {
{ 0, NULL }
};
+/* We have more then 32 logging domains. Assert that it compiles to a 64 bit sized enum */
+G_STATIC_ASSERT (sizeof (NMLogDomain) >= sizeof (guint64));
+
/* Combined domains */
#define LOGD_ALL_STRING "ALL"
#define LOGD_DEFAULT_STRING "DEFAULT"