[PATCH libinput] Switch to _Static_assert from static_assert and make sure it exists

Peter Hutterer peter.hutterer at who-t.net
Mon May 16 01:46:28 UTC 2016


_Static_assert is the C keyword, the lowercase version is the C++ one.
Add the required configure.ac bits if this is missing.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac       | 6 ++++++
 src/evdev-tablet.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 8ddc3b6..cfbe024 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,6 +60,12 @@ AC_CHECK_DECL(CLOCK_MONOTONIC,[],
 	      [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile libinput")],
 	      [[#include <time.h>]])
 
+AC_MSG_CHECKING([whether _Static_assert() is supported])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[_Static_assert(1, "Test");]])],
+		  [AC_MSG_RESULT([yes])],
+		  [AC_DEFINE(_Static_assert(...), [/* */], [Noop _Static_assert() replacement])
+		   AC_MSG_RESULT([no])])
+
 PKG_PROG_PKG_CONFIG()
 PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0])
 PKG_CHECK_MODULES(LIBUDEV, [libudev])
diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 4e8b920..89340bd 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -1187,7 +1187,7 @@ static void
 tablet_mark_all_axes_changed(struct tablet_dispatch *tablet,
 			     struct libinput_tablet_tool *tool)
 {
-	static_assert(sizeof(tablet->changed_axes) ==
+	_Static_assert(sizeof(tablet->changed_axes) ==
 			      sizeof(tool->axis_caps),
 		      "Mismatching array sizes");
 
-- 
2.7.4



More information about the wayland-devel mailing list