Skip to content

Commit 269506e

Browse files
committed
ci: build libusb and hidraw backends as C++ on ubuntu
Issue #671 reported that libusb/hid.c failed to compile as C++ source; PR #811 made it C++-clean. linux/hid.c already builds as C++. There is no CI step that exercises the C++ compilation path, so a similar regression could slip through unnoticed. Add a step to the ubuntu-cmake job that compiles libusb/hid.c and linux/hid.c with `g++ -xc++ -Wall -Wextra -Werror -Wformat-signedness`. That matches the existing C build's warning set, except `-pedantic` is omitted: libusb.h declares zero-size arrays and hidapi relies on designated initialisers — both GNU extensions that g++ accepts in its default mode but rejects under strict ISO C++. Assisted-by: Claude:claude-opus-4.7
1 parent e8243e1 commit 269506e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

.github/workflows/builds.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,21 @@ jobs:
154154
cd build/static_test
155155
make install
156156
157+
- name: Check C++ compile (backends as C++ sources)
158+
working-directory: hidapisrc
159+
# Verify the libusb/hidraw backend sources still compile as C++,
160+
# so regressions of #671 are caught. -pedantic is intentionally not
161+
# used here: libusb.h declares zero-size arrays and we rely on
162+
# designated initialisers, both GNU extensions that g++ accepts in
163+
# its default mode but rejects under strict ISO C++.
164+
run: |
165+
g++ -xc++ -Wall -Wextra -Werror -Wformat-signedness -D_GNU_SOURCE \
166+
-I hidapi -I libusb $(pkg-config --cflags libusb-1.0) \
167+
-c libusb/hid.c -o /tmp/hid_libusb_cxx.o
168+
g++ -xc++ -Wall -Wextra -Werror -Wformat-signedness -D_GNU_SOURCE \
169+
-I hidapi -I linux $(pkg-config --cflags libudev) \
170+
-c linux/hid.c -o /tmp/hid_hidraw_cxx.o
171+
157172
- name: Check Meson build
158173
run: |
159174
meson setup build_meson hidapisrc

0 commit comments

Comments
 (0)