From 0309ca0ee59f478313e9029ee732add46300761d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 22 Aug 2013 16:04:40 +1000 Subject: [PATCH] Ignore -Woverride-init in event-names.h Having the declarations in the form of [0...EV_MAX] = NULL together with the actual definitions causes warnings for every true definition if -Woverride-init is enabled. We can drop them for most as they're zero, but still need them for ev_max (which defaults to -1), not zero. So use the GCC pragma to disable the warnings for this file. Signed-off-by: Peter Hutterer --- libevdev/make-event-names.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libevdev/make-event-names.py b/libevdev/make-event-names.py index 018a228..67b963e 100755 --- a/libevdev/make-event-names.py +++ b/libevdev/make-event-names.py @@ -45,7 +45,6 @@ def print_bits(bits, prefix): if not hasattr(bits, prefix): return print("static const char * const %s_map[%s_MAX + 1] = {" % (prefix, prefix.upper())) - print(" [0 ... %s_MAX] = NULL," % prefix.upper()) for val, name in list(getattr(bits, prefix).items()): print(" [%s] = \"%s\"," % (name, name)) print("};") @@ -65,7 +64,6 @@ def print_python_bits(bits, prefix): def print_map(bits): print("static const char * const * const event_type_map[EV_MAX + 1] = {") - print(" [0 ... EV_MAX] = NULL,") for prefix in prefixes: if prefix == "BTN_" or prefix == "EV_" or prefix == "INPUT_PROP_": @@ -75,6 +73,8 @@ def print_map(bits): print("};") print("") + print("#pragma GCC diagnostic push") + print("#pragma GCC diagnostic ignored \"-Woverride-init\"") print("static const int ev_max[EV_MAX + 1] = {") print(" [0 ... EV_MAX] = -1,") for prefix in prefixes: @@ -82,6 +82,7 @@ def print_map(bits): continue print(" [EV_%s] = %s_MAX," % (prefix[:-1], prefix[:-1])) print("};") + print("#pragma GCC diagnostic pop /* \"-Woverride-init\" */") print("") def print_python_map(bits): -- 2.7.4