[PATCH v2 libevdev] Ignore -Woverride-init in event-names.h
Peter Hutterer
peter.hutterer at who-t.net
Thu Aug 22 16:13:58 PDT 2013
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 <peter.hutterer at who-t.net>
---
Serves me right for just copying from the server instead of double-checking
the docs. changes to v1:
- use pragma push
- pragma pop doesn't take an arg, use a comment instead
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 62851e3..2c5fd51 100755
--- a/libevdev/make-event-names.py
+++ b/libevdev/make-event-names.py
@@ -44,7 +44,6 @@ def print_bits(bits, prefix):
if not hasattr(bits, prefix):
return
str = "static const char * const {}_map[{}_MAX + 1] = {{\n".format(prefix, prefix.upper())
- str += " [0 ... {}_MAX] = NULL,\n".format(prefix.upper())
for val, name in getattr(bits, prefix).items():
str += " [{}] = \"{}\",\n".format(name, name)
str += "};\n"
@@ -65,7 +64,6 @@ def print_python_bits(bits, prefix):
def print_map(bits):
str = "static const char * const * const event_type_map[EV_MAX + 1] = {\n"
- str += " [0 ... EV_MAX] = NULL,\n"
for prefix in prefixes:
if prefix == "BTN_" or prefix == "EV_" or prefix == "INPUT_PROP_":
@@ -74,6 +72,8 @@ def print_map(bits):
str += "};\n"
+ str += "#pragma GCC diagnostic push\n"
+ str += "#pragma GCC diagnostic ignored \"-Woverride-init\"\n"
str += "static const int ev_max[EV_MAX + 1] = {\n"
str += " [0 ... EV_MAX] = -1,\n"
for prefix in prefixes:
@@ -81,6 +81,7 @@ def print_map(bits):
continue
str += " [EV_{}] = {}_MAX,\n".format(prefix[:-1], prefix[:-1])
str += "};\n"
+ str += "#pragma GCC diagnostic pop /* \"-Woverride-init\" */\n"
return str
def print_python_map(bits):
--
1.8.2.1
More information about the Input-tools
mailing list