From 670eb57321afabf3cc81a260200133078e295860 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 25 Jan 2015 21:42:37 +0100 Subject: [PATCH] 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 --- src/nm-logging.c | 3 +++ 1 file changed, 3 insertions(+) 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"