[PATCH libevdev] Shut up clang compiler warnings
David Herrmann
dh.herrmann at gmail.com
Tue Jan 6 05:11:48 PST 2015
Hi
On Tue, Jan 6, 2015 at 12:12 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> 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")
Are you sure the #if is needed? Why not:
print("#pragma clang diagnostic push")
print("#pragma clang diagnostic ignored \"-Winitializer-overrides\"")
print("#pragma GCC diagnostic push")
print("#pragma GCC diagnostic ignored \"-Woverride-init\"")
I mean if clang doesn't understand a GCC pragma _value_, it should
silently ignore it, right?
Anyway, in both cases:
Reviewed-by: David Herrmann <dh.herrmann at gmail.com>
Thanks
David
> 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
>
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/input-tools
More information about the Input-tools
mailing list