[PATCH libevdev] Shut up clang compiler warnings

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 5 15:12:23 PST 2015


clang looks at GCC pragmas, but doesn't understand -Woverride-init. Instead,
it uses -Winitializer-overrides.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 libevdev/make-event-names.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libevdev/make-event-names.py b/libevdev/make-event-names.py
index 980283f..835441e 100755
--- a/libevdev/make-event-names.py
+++ b/libevdev/make-event-names.py
@@ -82,8 +82,13 @@ def print_map(bits):
 	print("};")
 	print("")
 
+	print("#if __clang__")
+	print("#pragma clang diagnostic push")
+	print("#pragma clang diagnostic ignored \"-Winitializer-overrides\"")
+	print("#else")
 	print("#pragma GCC diagnostic push")
 	print("#pragma GCC diagnostic ignored \"-Woverride-init\"")
+	print("#endif")
 	print("static const int ev_max[EV_MAX + 1] = {")
 	print("	[0 ... EV_MAX] = -1,")
 	for prefix in prefixes:
@@ -91,7 +96,11 @@ def print_map(bits):
 			continue
 		print("	[EV_%s] = %s_MAX," % (prefix[:-1], prefix[:-1]))
 	print("};")
+	print("#if __clang__")
+	print("#pragma clang diagnostic pop /* \"-Winitializer-overrides\" */")
+	print("#else")
 	print("#pragma GCC diagnostic pop /* \"-Woverride-init\" */")
+	print("#endif");
 	print("")
 
 def print_python_map(bits):
-- 
2.1.0



More information about the Input-tools mailing list