Skip to contentSkip to conversation

libinput: fix missing static_assert symbol

PATCH New Baruch Siach 2 participants 5 messages May 15, 2016 – May 16, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libinput: fix missing static_assert symbol

static_assert() in from C++. Don't use it in C code.

Fixes:
http://autobuild.buildroot.net/results/3eb/3eb32c19f90a5fd8d45a0c36676e015e8278a469/
http://autobuild.buildroot.net/results/184/1844890c65615f1676a85c6fac78937249eee9f1/
http://autobuild.buildroot.net/results/3a3/3a3f8c5624e8019a6eababbf6e7440fdd668f85f/

---
 .../0002-tablet-remove-C-static_assert.patch       | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 package/libinput/0002-tablet-remove-C-static_assert.patch
package/libinput/0002-tablet-remove-C-static_assert.patch new file +39 -0
new file mode 100644
index 000000000000..6998c13437a5
@@ -0,0 +1,39 @@
+From f0a145dea72d1ff2ef6c110c7eaa505bc5ccec02 Mon Sep 17 00:00:00 2001
+From: Baruch Siach <[email protected]>
+Date: Sat, 14 May 2016 22:50:38 +0300
+Subject: [PATCH] tablet: remove C++ static_assert
+
+static_assert() is C++ only. Build may fail with:
+
+  CCLD     event-debug
+../src/.libs/libinput.so: undefined reference to `static_assert'
+collect2: error: ld returned 1 exit status
+
+Use just assert() like the rest of the code.
+
+Signed-off-by: Baruch Siach <[email protected]>
+---
+Patch status: reported upstream 
+(https://lists.freedesktop.org/archives/wayland-devel/2016-May/028876.html)
+
+ src/evdev-tablet.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
+index be828d965552..9c81be434d2f 100644
+--- a/src/evdev-tablet.c
++++ b/src/evdev-tablet.c
+@@ -1178,9 +1178,7 @@ static void
+ tablet_mark_all_axes_changed(struct tablet_dispatch *tablet,
+ 			     struct libinput_tablet_tool *tool)
+ {
+-	static_assert(sizeof(tablet->changed_axes) ==
+-			      sizeof(tool->axis_caps),
+-		      "Mismatching array sizes");
++	assert(sizeof(tablet->changed_axes) == sizeof(tool->axis_caps));
+ 
+ 	memcpy(tablet->changed_axes,
+ 	       tool->axis_caps,
+-- 
+2.8.1
+
Signature · 1 line
2.8.1
#1 lore raw

PATCH 1/1 libinput: fix missing static_assert symbol

Hi Buildroot list,

Quoted 1 line · Baruch Siach

static_assert() in from C++. Don't use it in C code.

This is wrong. As upstream developer Jonas ?dahl pointed out, C11 also defines static_assert as a convenience macro for _Static_assert. uClibc{,-ng} however that does not provide this macro. Would it make sense to disable libinput for uClibc{,-ng}?

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 libinput: fix missing static_assert symbol

Hello Baruch,

Quoted 9 lines · Baruch Siach

Hi Buildroot list,

Quoted 1 line · Baruch Siach

static_assert() in from C++. Don't use it in C code.

This is wrong. As upstream developer Jonas ?dahl pointed out, C11 also defines static_assert as a convenience macro for _Static_assert. uClibc{,-ng} however that does not provide this macro. Would it make sense to disable libinput for uClibc{,-ng}?

Or honor the second part of Jonas answer [1]: '... or define a no-op fallback when it is not defined.'

Seems a less radical solution than disable complete package (plus dependencies) for uClibc because of a minor issue?

Regards,
Peter

[1] https://lists.freedesktop.org/archives/wayland-devel/2016-May/028877.html

Quoted 3 lines

baruch

#3 lore raw

PATCH 1/1 libinput: fix missing static_assert symbol

Hello Baruch,

Quoted 14 lines · Peter Seiderer

Hello Baruch,

Quoted 9 lines · Baruch Siach

Hi Buildroot list,

Quoted 1 line · Baruch Siach

static_assert() in from C++. Don't use it in C code.

This is wrong. As upstream developer Jonas ?dahl pointed out, C11 also defines static_assert as a convenience macro for _Static_assert. uClibc{,-ng} however that does not provide this macro. Would it make sense to disable libinput for uClibc{,-ng}?

Quoted 6 lines

Or honor the second part of Jonas answer [1]: '... or define a no-op fallback when it is not defined.'

Seems a less radical solution than disable complete package (plus dependencies) for uClibc because of a minor issue?

Thinking more about it, I think your suggested patch is a good enough solution for buildroot purpose, so you can add my

in case you change the patch descriptions to mention it is not a C++ thing but static_assert is from C11 standard [2] (and besides your patch changes the logic from compile time error to possible run time error (dependent on NDEBUG flag)...

Regards,
Peter

[2] http://en.cppreference.com/w/c/error/static_assert

Quoted 14 lines

Regards,
Peter

[1] https://lists.freedesktop.org/archives/wayland-devel/2016-May/028877.html

Quoted 3 lines

baruch

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw

PATCH 1/1 libinput: fix missing static_assert symbol

Hi Peter,

Quoted 18 lines · Peter Seiderer
Quoted 10 lines · Peter Seiderer
Quoted 7 lines · Baruch Siach
Quoted 1 line · Baruch Siach

static_assert() in from C++. Don't use it in C code.

This is wrong. As upstream developer Jonas ?dahl pointed out, C11 also defines static_assert as a convenience macro for _Static_assert. uClibc{,-ng} however that does not provide this macro. Would it make sense to disable libinput for uClibc{,-ng}?

Quoted 5 lines

Or honor the second part of Jonas answer [1]: '... or define a no-op fallback when it is not defined.'

Seems a less radical solution than disable complete package (plus dependencies) for uClibc because of a minor issue?

Quoted 8 lines

Thinking more about it, I think your suggested patch is a good enough solution for buildroot purpose, so you can add my

in case you change the patch descriptions to mention it is not a C++ thing but static_assert is from C11 standard [2] (and besides your patch changes the logic from compile time error to possible run time error (dependent on NDEBUG flag)...

That alone is a good enough reason to not apply this patch IMO. Upstream has a better suggestion along the line of no-op fallback. I plan to respin with that fix instead

Thanks for reviewing,
baruch

Quoted 3 lines

[2] http://en.cppreference.com/w/c/error/static_assert

Quoted 2 lines

[1]
https://lists.freedesktop.org/archives/wayland-devel/2016-May/028877.html

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -