[PATCH libevdev] Ignore -Woverride-init in event-names.h
Peter Hutterer
peter.hutterer at who-t.net
Wed Aug 21 23:12:30 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>
---
This is on top of the python2/3 compatibility patch in
<20130822045406.GA12609 at yabbi.bne.redhat.com>, not in functionality but
in diff context.
libevdev/make-event-names.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libevdev/make-event-names.py b/libevdev/make-event-names.py
index 62851e3..b4d397a 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,7 @@ def print_map(bits):
str += "};\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 +80,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