libusbi.h: get rid of UNREFERENCED_PARAMETER
The way it's used in the code is incorrect. UNREFERENCED_PARAMETER evaluates to {(P) = (P);} and error with: error: lvalue required as left operand of assignment. Just use standard C.
UNREFERENCED_PARAMETER is a Windows special. It was introduced relatively recently in commit 521105f9.
In which cases does it produce an error?
You are suggesting a plain revert of commit 521105f. There must have been a reason it was done this way back then.
I don't see why {(P) = (P);} fails if P is a variable. You have to provide the full error log with context and any relevant information about compiler and environment.
$ ninja
[1/31] Compiling C object libusb-1.0.dll.p/libusb_io.c.obj
FAILED: libusb-1.0.dll.p/libusb_io.c.obj
"ccache" "cc" "-Ilibusb-1.0.dll.p" "-I." "-I.." "-I../libusb" "-I../libusb/os" "-fvisibility=hidden" "-fcolor-diagnostics" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-O0" "-g" "-D_GNU_SOURCE" "-pthread" -MD -MQ libusb-1.0.dll.p/libusb_io.c.obj -MF "libusb-1.0.dll.p/libusb_io.c.obj.d" -o libusb-1.0.dll.p/libusb_io.c.obj "-c" ../libusb/io.c
../libusb/io.c:1624:3: error: expected expression
else
^
../libusb/io.c:2051:3: error: expression is not assignable
usbi_warn(TRANSFER_CTX(transfer),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../libusb/libusbi.h:325:29: note: expanded from macro 'usbi_warn'
#define usbi_warn(ctx, ...) UNUSED(ctx)
^~~~~~~~~~~
../libusb/libusbi.h:77:21: note: expanded from macro 'UNUSED'
#define UNUSED(var) UNREFERENCED_PARAMETER(var)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/Mangix/scoop/apps/msys2/2022-01-28/clang64/include/winnt.h:1387:40: note: expanded from macro 'UNREFERENCED_PARAMETER'
#define UNREFERENCED_PARAMETER(P) {(P) = (P);}
~~~ ^
2 errors generated.
This is with logging disabled.
Another way to fix is:
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -321,9 +321,9 @@ void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
#else /* ENABLE_LOGGING */
-#define usbi_err(ctx, ...) UNUSED(ctx)
-#define usbi_warn(ctx, ...) UNUSED(ctx)
-#define usbi_info(ctx, ...) UNUSED(ctx)
+#define usbi_err(ctx, ...) do {} while (0)
+#define usbi_warn(ctx, ...) do {} while (0)
+#define usbi_info(ctx, ...) do {} while (0)
#define usbi_dbg(ctx, ...) do {} while (0)
#endif /* ENABLE_LOGGING */
Although that does cause -Wunused-variable warnings.
$ ninja [1/31] Compiling C object libusb-1.0.dll.p/libusb_io.c.obj FAILED: libusb-1.0.dll.p/libusb_io.c.obj
What is the compiler used here? I have no issues built latest libusb git master using MSYS2 mingw64 GCC compiler other than compiler warnings. Similarly github action has no issues either building libusb latest git other than the warnings (-Warray-bounds) in the Windows HID backend. Ref: https://github.com/libusb/libusb/runs/8168681042?check_suite_focus=true
Edit: I see that you are using MSYS2 clang64.
I tend to believe libusb does not work with MSYS2 clang64 yet. I just installed the MSYS2 clang64 toolchain environment and it does not work at all.
CLANG64 /c/work/libusb/libusb
$ gcc --version
clang version 14.0.6
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/clang64/bin
$ ./autogen.sh
autoreconf-2.71: export WARNINGS=
autoreconf-2.71: Entering directory '.'
autoreconf-2.71: configure.ac: not using Gettext
autoreconf-2.71: running: aclocal --force -I m4
autoreconf-2.71: configure.ac: tracing
autoreconf-2.71: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf-2.71: configure.ac: not using Intltool
autoreconf-2.71: configure.ac: not using Gtkdoc
autoreconf-2.71: running: aclocal --force -I m4
autoreconf-2.71: running: /usr/bin/autoconf-2.71 --force
autoreconf-2.71: running: /usr/bin/autoheader-2.71 --force
autoreconf-2.71: running: automake --add-missing --copy --force-missing
configure.ac:23: installing './compile'
configure.ac:26: installing './missing'
examples/Makefile.am: installing './depcomp'
autoreconf-2.71: Leaving directory '.'
configure: loading site script /etc/config.site
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking for inline... inline
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking whether make supports nested variables... yes
checking dependency style of gcc... gcc3
checking dependency style of g++... gcc3
checking build system type... x86_64-w64-mingw32
checking host system type... x86_64-w64-mingw32
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... C:/msys64/clang64/bin/ld
checking if the linker (C:/msys64/clang64/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /clang64/bin/nm -B
checking the name lister (/clang64/bin/nm -B) interface... BSD nm
checking whether ln -s works... no, using cp -pR
checking the maximum length of command line arguments... 8192
checking how to convert x86_64-w64-mingw32 file names to x86_64-w64-mingw32 format... func_convert_file_msys_to_w32
checking how to convert x86_64-w64-mingw32 file names to toolchain format... func_convert_file_msys_to_w32
checking for C:/msys64/clang64/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib_fallback
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /clang64/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... no
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (C:/msys64/clang64/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... C:/msys64/clang64/bin/ld
checking if the linker (C:/msys64/clang64/bin/ld) is GNU ld... yes
checking whether the g++ linker (C:/msys64/clang64/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -DDLL_EXPORT -DPIC
checking if g++ PIC flag -DDLL_EXPORT -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (C:/msys64/clang64/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking for windres... windres
checking whether make supports nested variables... (cached) yes
checking if gcc supports -std=gnu11... yes
checking operating system... Windows
checking for struct timespec... yes
checking for sys/time.h... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating libusb-1.0.pc
config.status: creating Makefile
config.status: creating libusb/Makefile
config.status: creating examples/Makefile
config.status: creating tests/Makefile
config.status: creating doc/Makefile
config.status: creating doc/doxygen.cfg
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
$ make
make all-recursive
make[1]: Entering directory '/c/work/libusb/libusb'
Making all in libusb
make[2]: Entering directory '/c/work/libusb/libusb/libusb'
CC core.lo
gcc: error: unknown argument: '-mwin32'
make[2]: *** [Makefile:680: core.lo] Error 1
make[2]: Leaving directory '/c/work/libusb/libusb/libusb'
make[1]: *** [Makefile:490: all-recursive] Error 1
make[1]: Leaving directory '/c/work/libusb/libusb'
make: *** [Makefile:395: all] Error 2
I addressed this before. Run
sed -e "s/-mwin32//g" -e "s/-Wl,--add-stdcall-alias//g" -i configure.ac
edit: here's a log from mingw32: https://gist.github.com/neheb/9233a359ee289448ac942437a4002f91
Makes no difference.
Anyway, I tried to use CMake and there is no issue.
It seems to me you need to upgrad to the latets MSYS2 clang64.
git clone https://github.com/libusb/libusb.git libusb_cmake
cd .\libusb_cmake\
git fetch origin pull/1134/head && git checkout FETCH_HEAD
cd libusb_cmake/
cmake -B build_clang64 -D BUILD_SHARED_LIBS=ON
cmake --build build_clang64
cmake build log
$ cmake -B build_clang64 -D BUILD_SHARED_LIBS=ON -- Building for: Ninja -- The C compiler identification is Clang 14.0.6 -- The CXX compiler identification is Clang 14.0.6 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/msys64/clang64/bin/cc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/msys64/clang64/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for clock_gettime -- Looking for clock_gettime - not found -- Looking for pthread_condattr_setclock -- Looking for pthread_condattr_setclock - not found -- Looking for pthread_setname_np -- Looking for pthread_setname_np - not found -- Looking for pthread_threadid_np -- Looking for pthread_threadid_np - not found -- Looking for eventfd -- Looking for eventfd - not found -- Looking for pipe2 -- Looking for pipe2 - not found -- Looking for syslog -- Looking for syslog - not found -- Looking for include file asm/types.h -- Looking for include file asm/types.h - not found -- Looking for include file dlfcn.h -- Looking for include file dlfcn.h - not found -- Looking for include file inttypes.h -- Looking for include file inttypes.h - found -- Looking for include file stdint.h -- Looking for include file stdint.h - found -- Looking for include file stdio.h -- Looking for include file stdio.h - found -- Looking for include file stdlib.h -- Looking for include file stdlib.h - found -- Looking for include file string.h -- Looking for include file string.h - found -- Looking for include file strings.h -- Looking for include file strings.h - found -- Looking for include file sys/stat.h -- Looking for include file sys/stat.h - found -- Looking for include file sys/time.h -- Looking for include file sys/time.h - found -- Looking for include file sys/types.h -- Looking for include file sys/types.h - found -- Looking for include file unistd.h -- Looking for include file unistd.h - found -- Looking for 4 include files stdlib.h, ..., float.h -- Looking for 4 include files stdlib.h, ..., float.h - found -- Looking for EFD_CLOEXEC -- Looking for EFD_CLOEXEC - not found -- Looking for EFD_NONBLOCK -- Looking for EFD_NONBLOCK - not found -- Looking for TFD_CLOEXEC -- Looking for TFD_CLOEXEC - not found -- Looking for timerfd_create -- Looking for timerfd_create - not found -- Performing Test HAVE_STRUCT_TIMESPEC -- Performing Test HAVE_STRUCT_TIMESPEC - Success -- Performing Test HAVE_VISIBILITY -- Performing Test HAVE_VISIBILITY - Success -- Configuring done -- Generating done -- Build files have been written to: C:/work/libusb/libusb_cmake/cmake/build_clang64
$ cmake --build build_clang64 [1/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/io.c.obj [2/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/hotplug.c.obj [3/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/descriptor.c.obj [4/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/strerror.c.obj [5/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/os/events_windows.c.obj In file included from C:/work/libusb/libusb_cmake/libusb/os/events_windows.c:24: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_common.h:162:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <pshpack1.h> ^ C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here #pragma pack(push,1) ^ In file included from C:/work/libusb/libusb_cmake/libusb/os/events_windows.c:24: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_common.h:192:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <poppack.h> ^ note: previous '#pragma pack' directive that modifies alignment is here 2 warnings generated. [6/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/sync.c.obj [7/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/os/windows_usbdk.c.obj In file included from C:/work/libusb/libusb_cmake/libusb/os/windows_usbdk.c:30: In file included from C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_usbdk.h:27: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_common.h:162:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <pshpack1.h> ^ C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here #pragma pack(push,1) ^ In file included from C:/work/libusb/libusb_cmake/libusb/os/windows_usbdk.c:30: In file included from C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_usbdk.h:27: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_common.h:192:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <poppack.h> ^ note: previous '#pragma pack' directive that modifies alignment is here 2 warnings generated. [8/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/core.c.obj [9/15] Building C object CMakeFiles/testlibusb.dir/C_/work/libusb/libusb_cmake/tests/testlib.c.obj [10/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/os/windows_common.c.obj In file included from C:/work/libusb/libusb_cmake/libusb/os/windows_common.c:30: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_common.h:162:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <pshpack1.h> ^ C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here #pragma pack(push,1) ^ In file included from C:/work/libusb/libusb_cmake/libusb/os/windows_common.c:30: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_common.h:192:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <poppack.h> ^ note: previous '#pragma pack' directive that modifies alignment is here 2 warnings generated. [11/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/os/windows_winusb.c.obj In file included from C:/work/libusb/libusb_cmake/libusb/os/windows_winusb.c:34: In file included from C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_winusb.h:30: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_common.h:162:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <pshpack1.h> ^ C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here #pragma pack(push,1) ^ In file included from C:/work/libusb/libusb_cmake/libusb/os/windows_winusb.c:34: In file included from C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_winusb.h:30: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_common.h:192:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <poppack.h> ^ note: previous '#pragma pack' directive that modifies alignment is here In file included from C:/work/libusb/libusb_cmake/libusb/os/windows_winusb.c:34: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_winusb.h:310:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <pshpack1.h> ^ C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here #pragma pack(push,1) ^ In file included from C:/work/libusb/libusb_cmake/libusb/os/windows_winusb.c:34: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_winusb.h:404:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <poppack.h> ^ note: previous '#pragma pack' directive that modifies alignment is here C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_winusb.h:446:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <pshpack1.h> ^ C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here #pragma pack(push,1) ^ In file included from C:/work/libusb/libusb_cmake/libusb/os/windows_winusb.c:34: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_winusb.h:456:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <poppack.h> ^ note: previous '#pragma pack' directive that modifies alignment is here C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_winusb.h:690:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <pshpack1.h> ^ C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here #pragma pack(push,1) ^ In file included from C:/work/libusb/libusb_cmake/libusb/os/windows_winusb.c:34: C:/work/libusb/libusb_cmake/cmake/../libusb/os/windows_winusb.h:699:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] #include <poppack.h> ^ note: previous '#pragma pack' directive that modifies alignment is here 8 warnings generated. [12/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/os/threads_windows.c.obj [13/15] Building C object CMakeFiles/testlibusb.dir/C_/work/libusb/libusb_cmake/tests/stress.c.obj [14/15] Linking C shared library libusb-1.0.dll [15/15] Linking C executable testlibusb.exe
</details>
cd libusb_cmake/
Sigh.
Pass -DENABLE_LOGGING=OFF
sed -e "s/-mwin32//g" -e "s/-Wl,--add-stdcall-alias//g" -i configure.ac
Thanks for the tip. Now I can build under MSYS2 clang64.
MSYS2 clang64 build log
$ git clone https://github.com/libusb/libusb.git libusb_clang64
Cloning into 'libusb_clang64'...
cdremote: Enumerating objects: 16499, done.
remote: Counting objects: 100% (890/890), done.
remote: Compressing objects: 100% (268/268), done.
remote: Total 16499 (delta 528), reused 694 (delta 487), pack-reused 15609
Receiving objects: 100% (16499/16499), 5.12 MiB | 19.50 MiB/s, done.
Resolving deltas: 100% (11870/11870), done.
$ cd libusb_clang64/
$ sed -e "s/-mwin32//g" -e "s/-Wl,--add-stdcall-alias//g" -i configure.ac
$ ./autogen.sh
autoreconf-2.71: export WARNINGS=
autoreconf-2.71: Entering directory '.'
autoreconf-2.71: configure.ac: not using Gettext
autoreconf-2.71: running: aclocal --force -I m4
autoreconf-2.71: configure.ac: tracing
autoreconf-2.71: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf-2.71: configure.ac: not using Intltool
autoreconf-2.71: configure.ac: not using Gtkdoc
autoreconf-2.71: running: aclocal --force -I m4
autoreconf-2.71: running: /usr/bin/autoconf-2.71 --force
autoreconf-2.71: running: /usr/bin/autoheader-2.71 --force
autoreconf-2.71: running: automake --add-missing --copy --force-missing
configure.ac:23: installing './compile'
configure.ac:27: installing './config.guess'
configure.ac:27: installing './config.sub'
configure.ac:26: installing './install-sh'
configure.ac:26: installing './missing'
Makefile.am: installing './INSTALL'
examples/Makefile.am: installing './depcomp'
autoreconf-2.71: Leaving directory '.'
configure: loading site script /etc/config.site
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking for inline... inline
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking whether make supports nested variables... yes
checking dependency style of gcc... gcc3
checking dependency style of g++... gcc3
checking build system type... x86_64-w64-mingw32
checking host system type... x86_64-w64-mingw32
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... C:/msys64/clang64/bin/ld
checking if the linker (C:/msys64/clang64/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /clang64/bin/nm -B
checking the name lister (/clang64/bin/nm -B) interface... BSD nm
checking whether ln -s works... no, using cp -pR
checking the maximum length of command line arguments... 8192
checking how to convert x86_64-w64-mingw32 file names to x86_64-w64-mingw32 format... func_convert_file_msys_to_w32
checking how to convert x86_64-w64-mingw32 file names to toolchain format... func_convert_file_msys_to_w32
checking for C:/msys64/clang64/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib_fallback
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /clang64/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... no
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (C:/msys64/clang64/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... C:/msys64/clang64/bin/ld
checking if the linker (C:/msys64/clang64/bin/ld) is GNU ld... yes
checking whether the g++ linker (C:/msys64/clang64/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -DDLL_EXPORT -DPIC
checking if g++ PIC flag -DDLL_EXPORT -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (C:/msys64/clang64/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking for windres... windres
checking whether make supports nested variables... (cached) yes
checking if gcc supports -std=gnu11... yes
checking operating system... Windows
checking for struct timespec... yes
checking for sys/time.h... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating libusb-1.0.pc
config.status: creating Makefile
config.status: creating libusb/Makefile
config.status: creating examples/Makefile
config.status: creating tests/Makefile
config.status: creating doc/Makefile
config.status: creating doc/doxygen.cfg
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
$ make
make all-recursive
make[1]: Entering directory '/c/work/libusb/libusb_clang64'
Making all in libusb
make[2]: Entering directory '/c/work/libusb/libusb_clang64/libusb'
CC core.lo
CC descriptor.lo
CC hotplug.lo
CC io.lo
CC strerror.lo
CC sync.lo
CC os/events_windows.lo
In file included from os/events_windows.c:24:
os/windows_common.h:162:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <pshpack1.h>
^
C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
#pragma pack(push,1)
^
In file included from os/events_windows.c:24:
os/windows_common.h:192:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <poppack.h>
^
note: previous '#pragma pack' directive that modifies alignment is here
2 warnings generated.
CC os/threads_windows.lo
RC libusb-1.0.lo
CC os/windows_common.lo
In file included from os/windows_common.c:30:
os/windows_common.h:162:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <pshpack1.h>
^
C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
#pragma pack(push,1)
^
In file included from os/windows_common.c:30:
os/windows_common.h:192:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <poppack.h>
^
note: previous '#pragma pack' directive that modifies alignment is here
2 warnings generated.
CC os/windows_usbdk.lo
In file included from os/windows_usbdk.c:30:
In file included from os/windows_usbdk.h:27:
os/windows_common.h:162:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <pshpack1.h>
^
C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
#pragma pack(push,1)
^
In file included from os/windows_usbdk.c:30:
In file included from os/windows_usbdk.h:27:
os/windows_common.h:192:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <poppack.h>
^
note: previous '#pragma pack' directive that modifies alignment is here
2 warnings generated.
CC os/windows_winusb.lo
In file included from os/windows_winusb.c:34:
In file included from os/windows_winusb.h:30:
os/windows_common.h:162:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <pshpack1.h>
^
C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
#pragma pack(push,1)
^
In file included from os/windows_winusb.c:34:
In file included from os/windows_winusb.h:30:
os/windows_common.h:192:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <poppack.h>
^
note: previous '#pragma pack' directive that modifies alignment is here
In file included from os/windows_winusb.c:34:
os/windows_winusb.h:310:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <pshpack1.h>
^
C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
#pragma pack(push,1)
^
In file included from os/windows_winusb.c:34:
os/windows_winusb.h:404:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <poppack.h>
^
note: previous '#pragma pack' directive that modifies alignment is here
os/windows_winusb.h:446:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <pshpack1.h>
^
C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
#pragma pack(push,1)
^
In file included from os/windows_winusb.c:34:
os/windows_winusb.h:456:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <poppack.h>
^
note: previous '#pragma pack' directive that modifies alignment is here
os/windows_winusb.h:690:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <pshpack1.h>
^
C:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
#pragma pack(push,1)
^
In file included from os/windows_winusb.c:34:
os/windows_winusb.h:699:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <poppack.h>
^
note: previous '#pragma pack' directive that modifies alignment is here
8 warnings generated.
CCLD libusb-1.0.la
DLLTOOL .libs/libusb-1.0.dll.a
make[2]: Leaving directory '/c/work/libusb/libusb_clang64/libusb'
Making all in examples
make[2]: Entering directory '/c/work/libusb/libusb_clang64/examples'
CC dpfp.o
CCLD dpfp.exe
CC dpfp_threaded-dpfp.o
CCLD dpfp_threaded.exe
CC ezusb.o
CC fxload.o
CCLD fxload.exe
CC hotplugtest.o
CCLD hotplugtest.exe
CC listdevs.o
CCLD listdevs.exe
CC sam3u_benchmark.o
CCLD sam3u_benchmark.exe
CC testlibusb.o
CCLD testlibusb.exe
CC xusb.o
CCLD xusb.exe
make[2]: Leaving directory '/c/work/libusb/libusb_clang64/examples'
Making all in tests
make[2]: Entering directory '/c/work/libusb/libusb_clang64/tests'
CC stress.o
CC testlib.o
CCLD stress.exe
make[2]: Leaving directory '/c/work/libusb/libusb_clang64/tests'
make[2]: Entering directory '/c/work/libusb/libusb_clang64'
make[2]: Leaving directory '/c/work/libusb/libusb_clang64'
make[1]: Leaving directory '/c/work/libusb/libusb_clang64'
Pass --disable-log
I can't tell if I'm being trolled.
Pass --disable-log
I can't tell if I'm being trolled.
Hmm, I never see you mentioned the option in the issue description...
That's the third time I mention disabling logging in this PR.
That's the third time I mention disabling logging in this PR.
I see. Sorry about that. I missed the first one. But I already started the automake build when you mentioned the CMake option.
Now I can reproduce the issue with the CMake build.
$ cmake --build build_clang64
[1/15] Building C object CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/descriptor.c.obj
FAILED: CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/descriptor.c.obj
C:\msys64\clang64\bin\cc.exe -Dusb_1_0_EXPORTS -IC:/work/libusb/libusb_cmake/cmake/../libusb -IC:/work/libusb/libusb_cmake/cmake/build_clang64 -IC:/work/libusb/libusb_cmake/cmake/../libusb/os -MD -MT CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/descriptor.c.obj -MF CMakeFiles\usb-1.0.dir\C_\work\libusb\libusb_cmake\libusb\descriptor.c.obj.d -o CMakeFiles/usb-1.0.dir/C_/work/libusb/libusb_cmake/libusb/descriptor.c.obj -c C:/work/libusb/libusb_cmake/libusb/descriptor.c
C:/work/libusb/libusb_cmake/libusb/descriptor.c:1112:3: error: expression is not assignable
usbi_warn(HANDLE_CTX(dev_handle), "suspicious bLength %u for language ID string descriptor", str.desc.bLength);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/work/libusb/libusb_cmake/cmake/../libusb/libusbi.h:325:29: note: expanded from macro 'usbi_warn'
#define usbi_warn(ctx, ...) UNUSED(ctx)
^~~~~~~~~~~
C:/work/libusb/libusb_cmake/cmake/../libusb/libusbi.h:77:21: note: expanded from macro 'UNUSED'
#define UNUSED(var) UNREFERENCED_PARAMETER(var)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/clang64/include/winnt.h:1387:40: note: expanded from macro 'UNREFERENCED_PARAMETER'
#define UNREFERENCED_PARAMETER(P) {(P) = (P);}
~~~ ^
C:/work/libusb/libusb_cmake/libusb/descriptor.c:1123:3: error: expression is not assignable
usbi_warn(HANDLE_CTX(dev_handle), "suspicious bLength %u for string descriptor (read %d)", str.desc.bLength, r);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/work/libusb/libusb_cmake/cmake/../libusb/libusbi.h:325:29: note: expanded from macro 'usbi_warn'
#define usbi_warn(ctx, ...) UNUSED(ctx)
^~~~~~~~~~~
C:/work/libusb/libusb_cmake/cmake/../libusb/libusbi.h:77:21: note: expanded from macro 'UNUSED'
#define UNUSED(var) UNREFERENCED_PARAMETER(var)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/clang64/include/winnt.h:1387:40: note: expanded from macro 'UNREFERENCED_PARAMETER'
#define UNREFERENCED_PARAMETER(P) {(P) = (P);}
~~~ ^
2 errors generated.
ping @dickens as he authored the original commit.
ping @dickens as he authored the original commit.
Unfortunately Chris has not touched libusb since March 2021. Hopefully he can come back soon.
edit: here's a log from mingw32: https://gist.github.com/neheb/9233a359ee289448ac942437a4002f91
Makes no difference.
Indeed MSYS2 mingw64 gcc build failed as well with the option --disable-log and it seems to me there are multiple issues.
MSYS2 mingw64 build log
$ ./configure --enable-examples-build --enable-tests-build --disable-log
configure: loading site script /etc/config.site
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking for inline... inline
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking whether make supports nested variables... yes
checking dependency style of gcc... gcc3
checking dependency style of g++... gcc3
checking build system type... x86_64-w64-mingw32
checking host system type... x86_64-w64-mingw32
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe
checking if the linker (C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /mingw64/bin/nm -B
checking the name lister (/mingw64/bin/nm -B) interface... BSD nm
checking whether ln -s works... no, using cp -pR
checking the maximum length of command line arguments... 8192
checking how to convert x86_64-w64-mingw32 file names to x86_64-w64-mingw32 format... func_convert_file_msys_to_w32
checking how to convert x86_64-w64-mingw32 file names to toolchain format... func_convert_file_msys_to_w32
checking for C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /mingw64/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... no
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe
checking if the linker (C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe) is GNU ld... yes
checking whether the g++ linker (C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe) supports shared libraries... yes
checking for g++ option to produce PIC... -DDLL_EXPORT -DPIC
checking if g++ PIC flag -DDLL_EXPORT -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe) supports shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking for windres... windres
checking whether make supports nested variables... (cached) yes
checking if gcc supports -std=gnu11... yes
checking operating system... Windows
checking for struct timespec... yes
checking for sys/time.h... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating libusb-1.0.pc
config.status: creating Makefile
config.status: creating libusb/Makefile
config.status: creating examples/Makefile
config.status: creating tests/Makefile
config.status: creating doc/Makefile
config.status: creating doc/doxygen.cfg
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
$ make -i
make all-recursive
make[1]: Entering directory '/c/work/libusb/libusb'
Making all in libusb
make[2]: Entering directory '/c/work/libusb/libusb/libusb'
CC core.lo
core.c: In function 'do_close':
core.c:1414:25: error: expected '}' before 'else'
1414 | else
| ^~~~
core.c:1423:17: error: 'transfer' undeclared (first use in this function); did you mean 'itransfer'?
1423 | transfer->dev_handle = NULL;
| ^~~~~~~~
| itransfer
core.c:1423:17: note: each undeclared identifier is reported only once for each function it appears in
core.c: At top level:
core.c:1432:27: error: expected declaration specifiers or '...' before '&' token
1432 | usbi_mutex_unlock(&ctx->flying_transfers_lock);
| ^
core.c:1434:25: error: expected declaration specifiers or '...' before '&' token
1434 | usbi_mutex_lock(&ctx->open_devs_lock);
| ^
core.c:1435:18: error: expected declaration specifiers or '...' before '&' token
1435 | list_del(&dev_handle->list);
| ^
core.c:1436:27: error: expected declaration specifiers or '...' before '&' token
1436 | usbi_mutex_unlock(&ctx->open_devs_lock);
| ^
core.c:1438:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
1438 | usbi_backend.close(dev_handle);
| ^
core.c:1439:39: error: expected ')' before '->' token
1439 | libusb_unref_device(dev_handle->dev);
| ^~
| )
core.c:1440:28: error: expected declaration specifiers or '...' before '&' token
1440 | usbi_mutex_destroy(&dev_handle->lock);
| ^
core.c:1441:9: warning: data definition has no type or storage class
1441 | free(dev_handle);
| ^~~~
core.c:1441:9: error: type defaults to 'int' in declaration of 'free' [-Werror=implicit-int]
core.c:1441:9: warning: parameter names (without types) in function declaration
core.c:1441:9: error: conflicting types for 'free'; have 'int()'
In file included from libusbi.h:33,
from core.c:23:
C:/msys64/mingw64/include/stdlib.h:536:16: note: previous declaration of 'free' with type 'void(void *)'
536 | void __cdecl free(void *_Memory);
| ^~~~
core.c:1442:1: error: expected identifier or '(' before '}' token
1442 | }
| ^
cc1.exe: some warnings being treated as errors
make[2]: [Makefile:680: core.lo] Error 1 (ignored)
CC descriptor.lo
In file included from C:/msys64/mingw64/include/minwindef.h:163,
from C:/msys64/mingw64/include/windef.h:9,
from C:/msys64/mingw64/include/windows.h:69,
from libusb.h:64,
from libusbi.h:38,
from descriptor.c:22:
descriptor.c: In function 'libusb_get_string_descriptor_ascii':
libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
descriptor.c:1112:17: note: in expansion of macro 'usbi_warn'
1112 | usbi_warn(HANDLE_CTX(dev_handle), "suspicious bLength %u for language ID string descriptor", str.desc.bLength);
| ^~~~~~~~~
libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
descriptor.c:1123:17: note: in expansion of macro 'usbi_warn'
1123 | usbi_warn(HANDLE_CTX(dev_handle), "suspicious bLength %u for string descriptor (read %d)", str.desc.bLength, r);
| ^~~~~~~~~
make[2]: [Makefile:680: descriptor.lo] Error 1 (ignored)
CC hotplug.lo
CC io.lo
io.c: In function 'libusb_cancel_transfer':
io.c:1624:17: error: expected '}' before 'else'
1624 | else
| ^~~~
io.c:1617:17: error: label 'out' used but not defined
1617 | goto out;
| ^~~~
io.c: At top level:
io.c:1631:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
1631 | itransfer->state_flags |= USBI_TRANSFER_CANCELLING;
| ^~
io.c:1633:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
1633 | out:
| ^
io.c:1635:9: error: expected identifier or '(' before 'return'
1635 | return r;
| ^~~~~~
io.c:1636:1: error: expected identifier or '(' before '}' token
1636 | }
| ^
In file included from C:/msys64/mingw64/include/minwindef.h:163,
from C:/msys64/mingw64/include/windef.h:9,
from C:/msys64/mingw64/include/windows.h:69,
from libusb.h:64,
from libusbi.h:38,
from io.c:24:
io.c: In function 'handle_timeout':
libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
io.c:2051:17: note: in expansion of macro 'usbi_warn'
2051 | usbi_warn(TRANSFER_CTX(transfer),
| ^~~~~~~~~
io.c: In function 'libusb_cancel_transfer':
io.c:1629:9: warning: control reaches end of non-void function [-Wreturn-type]
1629 | }
| ^
make[2]: [Makefile:680: io.lo] Error 1 (ignored)
CC strerror.lo
CC sync.lo
In file included from C:/msys64/mingw64/include/minwindef.h:163,
from C:/msys64/mingw64/include/windef.h:9,
from C:/msys64/mingw64/include/windows.h:69,
from libusb.h:64,
from libusbi.h:38,
from sync.c:23:
sync.c: In function 'libusb_control_transfer':
libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
sync.c:160:17: note: in expansion of macro 'usbi_warn'
160 | usbi_warn(HANDLE_CTX(dev_handle),
| ^~~~~~~~~
sync.c: In function 'do_sync_bulk_transfer':
libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
sync.c:220:17: note: in expansion of macro 'usbi_warn'
220 | usbi_warn(HANDLE_CTX(dev_handle),
| ^~~~~~~~~
make[2]: [Makefile:680: sync.lo] Error 1 (ignored)
CC os/events_windows.lo
In file included from C:/msys64/mingw64/include/minwindef.h:163,
from C:/msys64/mingw64/include/windef.h:9,
from C:/msys64/mingw64/include/windows.h:69,
from ./libusb.h:64,
from ./libusbi.h:38,
from os/events_windows.c:23:
os/events_windows.c: In function 'usbi_create_event':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/events_windows.c:30:17: note: in expansion of macro 'usbi_err'
30 | usbi_err(NULL, "CreateEvent failed: %s", windows_error_str(0));
| ^~~~~~~~
os/events_windows.c: In function 'usbi_destroy_event':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/events_windows.c:40:17: note: in expansion of macro 'usbi_warn'
40 | usbi_warn(NULL, "CloseHandle failed: %s", windows_error_str(0));
| ^~~~~~~~~
os/events_windows.c: In function 'usbi_signal_event':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/events_windows.c:46:17: note: in expansion of macro 'usbi_warn'
46 | usbi_warn(NULL, "SetEvent failed: %s", windows_error_str(0));
| ^~~~~~~~~
os/events_windows.c: In function 'usbi_clear_event':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/events_windows.c:52:17: note: in expansion of macro 'usbi_warn'
52 | usbi_warn(NULL, "ResetEvent failed: %s", windows_error_str(0));
| ^~~~~~~~~
os/events_windows.c: In function 'usbi_create_timer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/events_windows.c:60:17: note: in expansion of macro 'usbi_warn'
60 | usbi_warn(NULL, "CreateWaitableTimer failed: %s", windows_error_str(0));
| ^~~~~~~~~
os/events_windows.c: In function 'usbi_destroy_timer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/events_windows.c:70:17: note: in expansion of macro 'usbi_warn'
70 | usbi_warn(NULL, "CloseHandle failed: %s", windows_error_str(0));
| ^~~~~~~~~
os/events_windows.c: In function 'usbi_arm_timer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/events_windows.c:97:17: note: in expansion of macro 'usbi_warn'
97 | usbi_warn(NULL, "SetWaitableTimer failed: %s", windows_error_str(0));
| ^~~~~~~~~
os/events_windows.c: In function 'usbi_disarm_timer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/events_windows.c:116:17: note: in expansion of macro 'usbi_warn'
116 | usbi_warn(NULL, "SetWaitableTimer failed: %s", windows_error_str(0));
| ^~~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/events_windows.c:121:17: note: in expansion of macro 'usbi_warn'
121 | usbi_warn(NULL, "SetWaitableTimer failed: %s", windows_error_str(0));
| ^~~~~~~~~
make[2]: [Makefile:680: os/events_windows.lo] Error 1 (ignored)
CC os/threads_windows.lo
RC libusb-1.0.lo
CC os/windows_common.lo
In file included from C:/msys64/mingw64/include/minwindef.h:163,
from C:/msys64/mingw64/include/windef.h:9,
from C:/msys64/mingw64/include/windows.h:69,
from ./libusb.h:64,
from ./libusbi.h:38,
from os/windows_common.c:29:
os/windows_common.c: In function 'htab_hash':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_common.c:250:17: note: in expansion of macro 'usbi_err'
250 | usbi_err(NULL, "hash table is full (%lu entries)", HTAB_SIZE);
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_common.c:257:17: note: in expansion of macro 'usbi_err'
257 | usbi_err(NULL, "could not duplicate string for hash table");
| ^~~~~~~~
os/windows_common.c: In function 'windows_force_sync_completion':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_common.c:307:17: note: in expansion of macro 'usbi_err'
307 | usbi_err(TRANSFER_CTX(transfer), "failed to post I/O completion: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_common.c: In function 'get_windows_version':
os/windows_common.c:331:25: warning: variable 'arch' set but not used [-Wunused-but-set-variable]
331 | const char *w, *arch;
| ^~~~
os/windows_common.c:331:21: warning: variable 'w' set but not used [-Wunused-but-set-variable]
331 | const char *w, *arch;
| ^
os/windows_common.c: In function 'windows_cancel_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_common.c:786:9: note: in expansion of macro 'usbi_warn'
786 | usbi_warn(ITRANSFER_CTX(itransfer), "cancellation not supported for this transfer's driver");
| ^~~~~~~~~
make[2]: [Makefile:680: os/windows_common.lo] Error 1 (ignored)
CC os/windows_usbdk.lo
In file included from C:/msys64/mingw64/include/minwindef.h:163,
from C:/msys64/mingw64/include/windef.h:9,
from C:/msys64/mingw64/include/windows.h:69,
from os/windows_usbdk.c:26:
os/windows_usbdk.c: In function 'usbdk_close':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_usbdk.c:432:17: note: in expansion of macro 'usbi_err'
432 | usbi_err(HANDLE_CTX(dev_handle), "Redirector shutdown failed");
| ^~~~~~~~
os/windows_usbdk.c: In function 'usbdk_set_interface_altsetting':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_usbdk.c:466:17: note: in expansion of macro 'usbi_err'
466 | usbi_err(HANDLE_CTX(dev_handle), "SetAltsetting failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_usbdk.c: In function 'usbdk_clear_halt':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_usbdk.c:485:17: note: in expansion of macro 'usbi_err'
485 | usbi_err(HANDLE_CTX(dev_handle), "ResetPipe failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_usbdk.c: In function 'usbdk_reset_device':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_usbdk.c:497:17: note: in expansion of macro 'usbi_err'
497 | usbi_err(HANDLE_CTX(dev_handle), "ResetDevice failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_usbdk.c: In function 'usbdk_do_control_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_usbdk.c:549:17: note: in expansion of macro 'usbi_err'
549 | usbi_err(TRANSFER_CTX(transfer), "ControlTransfer failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_usbdk.c: In function 'usbdk_do_bulk_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_usbdk.c:591:17: note: in expansion of macro 'usbi_err'
591 | usbi_err(TRANSFER_CTX(transfer), "ReadPipe/WritePipe failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_usbdk.c: In function 'usbdk_do_iso_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_usbdk.c:615:17: note: in expansion of macro 'usbi_err'
615 | usbi_err(TRANSFER_CTX(transfer), "Allocation of IsochronousPacketsArray failed");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_usbdk.c:622:17: note: in expansion of macro 'usbi_err'
622 | usbi_err(TRANSFER_CTX(transfer), "Allocation of isochronousResultsArray failed");
| ^~~~~~~~
os/windows_usbdk.c: In function 'usbdk_submit_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_usbdk.c:666:17: note: in expansion of macro 'usbi_err'
666 | usbi_err(TRANSFER_CTX(transfer), "unsupported endpoint type %d", transfer->type);
| ^~~~~~~~
make[2]: [Makefile:680: os/windows_usbdk.lo] Error 1 (ignored)
CC os/windows_winusb.lo
os/windows_winusb.c: In function 'get_interface_details':
os/windows_winusb.c:263:14: warning: unused variable 'guid_string' [-Wunused-variable]
263 | char guid_string[MAX_GUID_STRING_LENGTH];
| ^~~~~~~~~~~
In file included from C:/msys64/mingw64/include/minwindef.h:163,
from C:/msys64/mingw64/include/windef.h:9,
from C:/msys64/mingw64/include/windows.h:69,
from os/windows_winusb.c:28:
os/windows_winusb.c: In function 'windows_assign_endpoints':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:522:17: note: in expansion of macro 'usbi_warn'
522 | usbi_warn(HANDLE_CTX(dev_handle), "could not read config descriptor: error %d", r);
| ^~~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:527:17: note: in expansion of macro 'usbi_err'
527 | usbi_err(HANDLE_CTX(dev_handle), "interface %d out of range for device", iface);
| ^~~~~~~~
os/windows_winusb.c: In function 'auto_claim':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:619:41: note: in expansion of macro 'usbi_err'
619 | usbi_err(TRANSFER_CTX(transfer), "program assertion failed - autoclaim_count was nonzero");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:625:25: note: in expansion of macro 'usbi_err'
625 | usbi_err(TRANSFER_CTX(transfer), "could not auto-claim any interface");
| ^~~~~~~~
os/windows_winusb.c: In function 'winusb_clear_transfer_priv':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2061:33: note: in expansion of macro 'usbi_warn'
2061 | usbi_warn(TRANSFER_CTX(transfer), "failed to unregister WinUSB isoch buffer: %s", windows_error_str(0));
| ^~~~~~~~~
os/windows_winusb.c: In function 'winusb_submit_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2092:17: note: in expansion of macro 'usbi_err'
2092 | usbi_err(TRANSFER_CTX(transfer), "unknown endpoint type %d", transfer->type);
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2097:17: note: in expansion of macro 'usbi_warn'
2097 | usbi_warn(TRANSFER_CTX(transfer),
| ^~~~~~~~~
os/windows_winusb.c: In function 'winusb_copy_transfer_data':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2122:17: note: in expansion of macro 'usbi_err'
2122 | usbi_err(TRANSFER_CTX(transfer), "program assertion failed - no function to copy transfer data");
| ^~~~~~~~
os/windows_winusb.c: In function 'winusbx_open':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2445:33: note: in expansion of macro 'usbi_err'
2445 | usbi_err(HANDLE_CTX(dev_handle), "could not open device %s (interface %d): %s", priv->usb_interface[i].path, i, windows_error_str(0));
| ^~~~~~~~
os/windows_winusb.c: In function 'winusbx_submit_control_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2810:25: note: in expansion of macro 'usbi_warn'
2810 | usbi_warn(TRANSFER_CTX(transfer), "cannot set configuration other than the default one");
| ^~~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2817:33: note: in expansion of macro 'usbi_warn'
2817 | usbi_warn(TRANSFER_CTX(transfer), "ControlTransfer failed: %s", windows_error_str(0));
| ^~~~~~~~~
os/windows_winusb.c: In function 'winusbx_set_interface_altsetting':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2838:17: note: in expansion of macro 'usbi_err'
2838 | usbi_err(HANDLE_CTX(dev_handle), "interface must be claimed first");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2843:17: note: in expansion of macro 'usbi_err'
2843 | usbi_err(HANDLE_CTX(dev_handle), "SetCurrentAlternateSetting failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_winusb.c: In function 'winusbx_submit_iso_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2897:17: note: in expansion of macro 'usbi_err'
2897 | usbi_err(TRANSFER_CTX(transfer), "unable to match endpoint to an open interface - cancelling transfer");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2915:25: note: in expansion of macro 'usbi_warn'
2915 | usbi_warn(TRANSFER_CTX(transfer), "libusbK DLL does not support isoch transfers");
| ^~~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2944:25: note: in expansion of macro 'usbi_err'
2944 | usbi_err(TRANSFER_CTX(transfer), "IsoReadPipe/IsoWritePipe failed: %s", windows_error_str(0));
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2958:25: note: in expansion of macro 'usbi_warn'
2958 | usbi_warn(TRANSFER_CTX(transfer), "WinUSB DLL does not support isoch transfers");
| ^~~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2963:25: note: in expansion of macro 'usbi_err'
2963 | usbi_err(TRANSFER_CTX(transfer), "size of WinUsb and libusb isoch packet descriptors don't match");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2971:33: note: in expansion of macro 'usbi_err'
2971 | usbi_err(TRANSFER_CTX(transfer), "couldn't query interface settings for USB pipe with index %d. Error: %s", idx, windows_error_str(0));
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:2981:25: note: in expansion of macro 'usbi_err'
2981 | usbi_err(TRANSFER_CTX(transfer), "couldn't find isoch endpoint 0x%02x", transfer->endpoint);
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3001:33: note: in expansion of macro 'usbi_err'
3001 | usbi_err(TRANSFER_CTX(transfer), "length of isoch buffer must be a multiple of the MaximumBytesPerInterval * 8 / Interval");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3011:41: note: in expansion of macro 'usbi_err'
3011 | usbi_err(TRANSFER_CTX(transfer), "isoch packets for OUT transfer with WinUSB must be contiguous in memory");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3024:33: note: in expansion of macro 'usbi_err'
3024 | usbi_err(TRANSFER_CTX(transfer), "failed to unregister WinUSB isoch buffer: %s", windows_error_str(0));
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3032:25: note: in expansion of macro 'usbi_err'
3032 | usbi_err(TRANSFER_CTX(transfer), "failed to register WinUSB isoch buffer: %s", windows_error_str(0));
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3055:25: note: in expansion of macro 'usbi_err'
3055 | usbi_err(TRANSFER_CTX(transfer), "ReadIsochPipeAsap/WriteIsochPipeAsap failed: %s", windows_error_str(0));
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3057:33: note: in expansion of macro 'usbi_warn'
3057 | usbi_warn(TRANSFER_CTX(transfer), "failed to unregister WinUSB isoch buffer: %s", windows_error_str(0));
| ^~~~~~~~~
os/windows_winusb.c: In function 'winusbx_submit_bulk_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3088:17: note: in expansion of macro 'usbi_err'
3088 | usbi_err(TRANSFER_CTX(transfer), "unable to match endpoint to an open interface - cancelling transfer");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3111:33: note: in expansion of macro 'usbi_err'
3111 | usbi_err(TRANSFER_CTX(transfer), "failed to set SHORT_PACKET_TERMINATE for endpoint %02X", transfer->endpoint);
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3116:25: note: in expansion of macro 'usbi_err'
3116 | usbi_err(TRANSFER_CTX(transfer), "cannot change ZERO_PACKET for endpoint %02X on Windows", transfer->endpoint);
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3125:17: note: in expansion of macro 'usbi_err'
3125 | usbi_err(TRANSFER_CTX(transfer), "ReadPipe/WritePipe failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_winusb.c: In function 'winusbx_clear_halt':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3143:17: note: in expansion of macro 'usbi_err'
3143 | usbi_err(HANDLE_CTX(dev_handle), "unable to match endpoint to an open interface - cannot clear");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3151:17: note: in expansion of macro 'usbi_err'
3151 | usbi_err(HANDLE_CTX(dev_handle), "ResetPipe failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_winusb.c: In function 'winusbx_cancel_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3173:17: note: in expansion of macro 'usbi_err'
3173 | usbi_err(TRANSFER_CTX(transfer), "AbortPipe failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_winusb.c: In function 'winusbx_reset_device':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3205:41: note: in expansion of macro 'usbi_err'
3205 | usbi_err(HANDLE_CTX(dev_handle), "AbortPipe (pipe address %02X) failed: %s",
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3211:41: note: in expansion of macro 'usbi_err'
3211 | usbi_err(HANDLE_CTX(dev_handle), "FlushPipe (pipe address %02X) failed: %s",
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3215:41: note: in expansion of macro 'usbi_err'
3215 | usbi_err(HANDLE_CTX(dev_handle), "ResetPipe (pipe address %02X) failed: %s",
| ^~~~~~~~
os/windows_winusb.c: In function 'hid_open':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3777:17: note: in expansion of macro 'usbi_err'
3777 | usbi_err(HANDLE_CTX(dev_handle), "program assertion failed - private HID structure is uninitialized");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3793:33: note: in expansion of macro 'usbi_warn'
3793 | usbi_warn(HANDLE_CTX(dev_handle), "could not open HID device in R/W mode (keyboard or mouse?) - trying without");
| ^~~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3796:41: note: in expansion of macro 'usbi_err'
3796 | usbi_err(HANDLE_CTX(dev_handle), "could not open device %s (interface %d): %s", priv->path, i, windows_error_str(0));
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3815:25: note: in expansion of macro 'usbi_err'
3815 | usbi_err(HANDLE_CTX(dev_handle), "could not gain access to HID top collection (HidD_GetAttributes)");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3828:25: note: in expansion of macro 'usbi_err'
3828 | usbi_err(HANDLE_CTX(dev_handle), "could not read HID preparsed data (HidD_GetPreparsedData)");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3832:25: note: in expansion of macro 'usbi_err'
3832 | usbi_err(HANDLE_CTX(dev_handle), "could not parse HID capabilities (HidP_GetCaps)");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3859:57: note: in expansion of macro 'usbi_warn'
3859 | usbi_warn(HANDLE_CTX(dev_handle), "program assertion failed - zero and nonzero report IDs used for %s",
| ^~~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3864:41: note: in expansion of macro 'usbi_warn'
3864 | usbi_warn(HANDLE_CTX(dev_handle), " could not process %s report IDs", type[j]);
| ^~~~~~~~~
os/windows_winusb.c: In function 'hid_set_interface_altsetting':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:3980:17: note: in expansion of macro 'usbi_err'
3980 | usbi_err(HANDLE_CTX(dev_handle), "set interface altsetting not supported for altsetting >0");
| ^~~~~~~~
os/windows_winusb.c: In function 'hid_submit_control_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4044:33: note: in expansion of macro 'usbi_warn'
4044 | usbi_warn(TRANSFER_CTX(transfer), "cannot set configuration other than the default one");
| ^~~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4059:25: note: in expansion of macro 'usbi_warn'
4059 | usbi_warn(TRANSFER_CTX(transfer), "unsupported HID control request");
| ^~~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:325:33: note: in expansion of macro 'UNUSED'
325 | #define usbi_warn(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4069:17: note: in expansion of macro 'usbi_warn'
4069 | usbi_warn(TRANSFER_CTX(transfer), "unsupported HID control request");
| ^~~~~~~~~
os/windows_winusb.c: In function 'hid_submit_bulk_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4108:17: note: in expansion of macro 'usbi_err'
4108 | usbi_err(TRANSFER_CTX(transfer), "unable to match endpoint to an open interface - cancelling transfer");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4150:17: note: in expansion of macro 'usbi_err'
4150 | usbi_err(TRANSFER_CTX(transfer), "HID transfer failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_winusb.c: In function 'hid_clear_halt':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4189:17: note: in expansion of macro 'usbi_err'
4189 | usbi_err(HANDLE_CTX(dev_handle), "unable to match endpoint to an open interface - cannot clear");
| ^~~~~~~~
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4199:17: note: in expansion of macro 'usbi_err'
4199 | usbi_err(HANDLE_CTX(dev_handle), "Flushing of HID queue failed: %s", windows_error_str(0));
| ^~~~~~~~
os/windows_winusb.c: In function 'hid_copy_transfer_data':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4222:41: note: in expansion of macro 'usbi_err'
4222 | usbi_err(TRANSFER_CTX(transfer), "OVERFLOW!");
| ^~~~~~~~
os/windows_winusb.c: In function 'composite_submit_control_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4426:9: note: in expansion of macro 'usbi_err'
4426 | usbi_err(TRANSFER_CTX(transfer), "no libusb supported interfaces to complete request");
| ^~~~~~~~
os/windows_winusb.c: In function 'composite_submit_bulk_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4441:17: note: in expansion of macro 'usbi_err'
4441 | usbi_err(TRANSFER_CTX(transfer), "unable to match endpoint to an open interface - cancelling transfer");
| ^~~~~~~~
os/windows_winusb.c: In function 'composite_submit_iso_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4462:17: note: in expansion of macro 'usbi_err'
4462 | usbi_err(TRANSFER_CTX(transfer), "unable to match endpoint to an open interface - cancelling transfer");
| ^~~~~~~~
os/windows_winusb.c: In function 'composite_clear_halt':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4482:17: note: in expansion of macro 'usbi_err'
4482 | usbi_err(HANDLE_CTX(dev_handle), "unable to match endpoint to an open interface - cannot clear");
| ^~~~~~~~
os/windows_winusb.c: In function 'composite_cancel_transfer':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4502:17: note: in expansion of macro 'usbi_err'
4502 | usbi_err(TRANSFER_CTX(transfer), "program assertion failed - invalid interface_number");
| ^~~~~~~~
os/windows_winusb.c: In function 'composite_copy_transfer_data':
./libusbi.h:77:25: error: lvalue required as left operand of assignment
77 | #define UNUSED(var) UNREFERENCED_PARAMETER(var)
| ^~~~~~~~~~~~~~~~~~~~~~
./libusbi.h:324:33: note: in expansion of macro 'UNUSED'
324 | #define usbi_err(ctx, ...) UNUSED(ctx)
| ^~~~~~
os/windows_winusb.c:4549:17: note: in expansion of macro 'usbi_err'
4549 | usbi_err(TRANSFER_CTX(transfer), "program assertion failed - no function to copy transfer data");
| ^~~~~~~~
make[2]: [Makefile:680: os/windows_winusb.lo] Error 1 (ignored)
CCLD libusb-1.0.la
libtool: error: 'core.lo' is not a valid libtool object
make[2]: [Makefile:609: libusb-1.0.la] Error 1 (ignored)
DLLTOOL .libs/libusb-1.0.dll.a
make[2]: Leaving directory '/c/work/libusb/libusb/libusb'
Making all in examples
make[2]: Entering directory '/c/work/libusb/libusb/examples'
CC dpfp.o
make[2]: *** No rule to make target '../libusb/libusb-1.0.la', needed by 'dpfp.exe'. Stop.
make[2]: Leaving directory '/c/work/libusb/libusb/examples'
make[1]: [Makefile:490: all-recursive] Error 1 (ignored)
make[1]: Leaving directory '/c/work/libusb/libusb'
edit: here's a log from mingw32: https://gist.github.com/neheb/9233a359ee289448ac942437a4002f91 Makes no difference.
Indeed MSYS2 mingw64 gcc build failed as well with the option
--disable-logand it seems to me there are multiple issues.
And indeed the patch in this pull request fixed the issue under MSYS2 mingw64 compiler. I can only guess at that time the compiler used is different and that was why Chris added the commit.
MSYS2 mingw64 build log with the patch from this pull request
$ make -i
make all-recursive
make[1]: Entering directory '/c/work/libusb/libusb'
Making all in libusb
make[2]: Entering directory '/c/work/libusb/libusb/libusb'
CC core.lo
CC descriptor.lo
CC hotplug.lo
CC io.lo
CC strerror.lo
CC sync.lo
CC os/events_windows.lo
CC os/threads_windows.lo
RC libusb-1.0.lo
CC os/windows_common.lo
os/windows_common.c: In function 'get_windows_version':
os/windows_common.c:331:25: warning: variable 'arch' set but not used [-Wunused-but-set-variable]
331 | const char *w, *arch;
| ^~~~
os/windows_common.c:331:21: warning: variable 'w' set but not used [-Wunused-but-set-variable]
331 | const char *w, *arch;
| ^
CC os/windows_usbdk.lo
CC os/windows_winusb.lo
os/windows_winusb.c: In function 'get_interface_details':
os/windows_winusb.c:263:14: warning: unused variable 'guid_string' [-Wunused-variable]
263 | char guid_string[MAX_GUID_STRING_LENGTH];
| ^~~~~~~~~~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3372:21: warning: array subscript 'struct libusb_interface_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3372 | id->bLength = LIBUSB_DT_INTERFACE_SIZE;
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 9 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3373:29: warning: array subscript 'struct libusb_interface_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3373 | id->bDescriptorType = LIBUSB_DT_INTERFACE;
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 9 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3374:30: warning: array subscript 'struct libusb_interface_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3374 | id->bInterfaceNumber = 0;
| ~~~~~~~~~~~~~~~~~~~~~^~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 9 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3375:31: warning: array subscript 'struct libusb_interface_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3375 | id->bAlternateSetting = 0;
| ~~~~~~~~~~~~~~~~~~~~~~^~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 9 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3376:27: warning: array subscript 'struct libusb_interface_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3376 | id->bNumEndpoints = num_endpoints;
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 9 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3377:29: warning: array subscript 'struct libusb_interface_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3377 | id->bInterfaceClass = 3;
| ~~~~~~~~~~~~~~~~~~~~^~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 9 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3378:32: warning: array subscript 'struct libusb_interface_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3378 | id->bInterfaceSubClass = 0;
| ~~~~~~~~~~~~~~~~~~~~~~~^~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 9 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3379:32: warning: array subscript 'struct libusb_interface_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3379 | id->bInterfaceProtocol = 0;
| ~~~~~~~~~~~~~~~~~~~~~~~^~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 9 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3380:24: warning: array subscript 'struct libusb_interface_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3380 | id->iInterface = 0;
| ~~~~~~~~~~~~~~~^~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 9 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3386:29: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3386 | ed->bLength = LIBUSB_DT_ENDPOINT_SIZE;
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 27 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3387:37: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3387 | ed->bDescriptorType = LIBUSB_DT_ENDPOINT;
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 27 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3388:38: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3388 | ed->bEndpointAddress = HID_IN_EP;
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 27 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3389:34: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3389 | ed->bmAttributes = 3;
| ~~~~~~~~~~~~~~~~~^~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 27 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3390:36: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3390 | ed->wMaxPacketSize = hid_priv->input_report_size - 1;
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 27 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3391:31: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'char[41]' [-Warray-bounds]
3391 | ed->bInterval = 10;
| ~~~~~~~~~~~~~~^~~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset 27 into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3396:29: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'struct libusb_endpoint_descriptor[1]' [-Warray-bounds]
3396 | ed->bLength = LIBUSB_DT_ENDPOINT_SIZE;
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset [27, 41] into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
os/windows_winusb.c:3340:14: note: at offset [34, 41] into object 'tmp' of size 41
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3397:37: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'struct libusb_endpoint_descriptor[1]' [-Warray-bounds]
3397 | ed->bDescriptorType = LIBUSB_DT_ENDPOINT;
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset [27, 41] into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
os/windows_winusb.c:3340:14: note: at offset [34, 41] into object 'tmp' of size 41
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3398:38: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'struct libusb_endpoint_descriptor[1]' [-Warray-bounds]
3398 | ed->bEndpointAddress = HID_OUT_EP;
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset [27, 41] into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
os/windows_winusb.c:3340:14: note: at offset [34, 41] into object 'tmp' of size 41
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3399:34: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'struct libusb_endpoint_descriptor[1]' [-Warray-bounds]
3399 | ed->bmAttributes = 3;
| ~~~~~~~~~~~~~~~~~^~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset [27, 41] into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
os/windows_winusb.c:3340:14: note: at offset [34, 41] into object 'tmp' of size 41
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3400:36: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'struct libusb_endpoint_descriptor[1]' [-Warray-bounds]
3400 | ed->wMaxPacketSize = hid_priv->output_report_size - 1;
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset [27, 41] into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
os/windows_winusb.c:3340:14: note: at offset [34, 41] into object 'tmp' of size 41
In function '_hid_get_config_descriptor',
inlined from '_hid_get_descriptor.constprop' at os/windows_winusb.c:3559:11:
os/windows_winusb.c:3401:31: warning: array subscript 'struct libusb_endpoint_descriptor[0]' is partly outside array bounds of 'struct libusb_endpoint_descriptor[1]' [-Warray-bounds]
3401 | ed->bInterval = 10;
| ~~~~~~~~~~~~~~^~~~
os/windows_winusb.c: In function '_hid_get_descriptor.constprop':
os/windows_winusb.c:3340:14: note: at offset [27, 41] into object 'tmp' of size 41
3340 | char tmp[HID_MAX_CONFIG_DESC_SIZE];
| ^~~
os/windows_winusb.c:3340:14: note: at offset [34, 41] into object 'tmp' of size 41
CCLD libusb-1.0.la
C:\msys64\mingw64\bin\ar.exe: `u' modifier ignored since `D' is the default (see `U')
DLLTOOL .libs/libusb-1.0.dll.a
make[2]: Leaving directory '/c/work/libusb/libusb/libusb'
Making all in examples
make[2]: Entering directory '/c/work/libusb/libusb/examples'
CC dpfp.o
CCLD dpfp.exe
CC dpfp_threaded-dpfp.o
CCLD dpfp_threaded.exe
CC ezusb.o
CC fxload.o
CCLD fxload.exe
CC hotplugtest.o
CCLD hotplugtest.exe
CC listdevs.o
CCLD listdevs.exe
CC sam3u_benchmark.o
CCLD sam3u_benchmark.exe
CC testlibusb.o
CCLD testlibusb.exe
CC xusb.o
CCLD xusb.exe
make[2]: Leaving directory '/c/work/libusb/libusb/examples'
Making all in tests
make[2]: Entering directory '/c/work/libusb/libusb/tests'
CC stress.o
CC testlib.o
CCLD stress.exe
make[2]: Leaving directory '/c/work/libusb/libusb/tests'
make[2]: Entering directory '/c/work/libusb/libusb'
make[2]: Leaving directory '/c/work/libusb/libusb'
make[1]: Leaving directory '/c/work/libusb/libusb'
Although that does cause -Wunused-variable warnings.
Then what about this variant:
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index c2b9a6b..6bd06f1 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -321,10 +321,10 @@ void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
#else /* ENABLE_LOGGING */
-#define usbi_err(ctx, ...) UNUSED(ctx)
-#define usbi_warn(ctx, ...) UNUSED(ctx)
-#define usbi_info(ctx, ...) UNUSED(ctx)
-#define usbi_dbg(ctx, ...) do {} while (0)
+#define usbi_err(ctx, ...) do { (void)(ctx); } while(0)
+#define usbi_warn(ctx, ...) do { (void)(ctx); } while(0)
+#define usbi_info(ctx, ...) do { (void)(ctx); } while(0)
+#define usbi_dbg(ctx, ...) do { (void)(ctx); } while(0)
#endif /* ENABLE_LOGGING */
It will, like your suggestion, leave UNREFERENCED_PARAMETER for whatever advantage that has, except for the logging macros, where the parameter sometimes is NULL. And should have no unused-variables warnings.
Note: commit 6cae9c6d added the ctx parameter to usbi_dbg but didn't change it from do-while to UNUSED. Here I am changing the others back to do-while but including the ctx reference, so I do the same with usbi_dbg.
Was going to update this PR. Cool that it was fixed.
Thanks. What was committed corresponds to what you wanted to update, I hope.
yeah basically.