While testing commit f2596972845b ("CodeSamples: Fix liburcu-signal support deprecation"), I observed build errors under Ubuntu 22.04. Which prompted me to test various combinations of cc and optimization levels in building under CodeSamples/. This patch set is a collection of fixes/adjustments to make such various choices happy. Patch 1/6 is a preliminary change for ease of experimenting alternative GCC_ARGS such as "-g -Wall -O0", "-g -Wall -O1", and so on, under CodeSamples/. Patch 2/6 fixes an issue around forward declaration of struct in .h file failing to satisfy compiler's assumption of accessing them from inline functions. Looks like this matters with some of gcc versions in low level optimization, but gcc of Ubuntu 22.04 hits this even at -O3. Actual declaration of a struct seems to be needed in front of inline functions who access such a struct. Patch 3/6 adjusts indirection level of pointer arguments in xchg(). Patch 4/6 adds "static" to __inline__ functions. Patch 5/6 fixes errors of duplicate symbols due to api.h being included in multiple .c files linked together. As a workaround, "#ifndef SUBOBJ" is added in api-pthreads.h and a flag of -DSUBOBJ is added in Makefiles to recipes of .c --> _sub.o. Patch 6/6 removes variables whose final values are never used. Recent clang is pretty strict on set-but-unused variables. To test against clang, you need to redirect cc --> clang by, for example, symlinking $HOME/bin/cc --> /usr/bin/clang or similar. Thanks, Akira -- Akira Yokosawa (6): CodeSamples: Put $(GCC_ARGS) in cc argument list CodeSamples/datastruct: Move struct declaration from .c to .h CodeSamples/advsync: Add explicit type cast in xchg() CodeSamples/count: Add static to __inline__ function declarations CodeSamples: Add #ifndef SUBOBJ to api-pthreads.h CodeSamples/datastruct/Issaquah: Remove unused variables CodeSamples/advsync/q.c | 2 +- CodeSamples/advsync/wfenqueue.c | 2 +- CodeSamples/api-pthreads/api-pthreads.h | 14 ++++++++++++++ CodeSamples/count/count_end.c | 4 ++-- CodeSamples/count/count_end_rcu.c | 4 ++-- CodeSamples/count/count_stack.c | 6 +++--- CodeSamples/count/count_stat_atomic.c | 6 +++--- CodeSamples/datastruct/Issaquah/Makefile | 14 ++++++++++---- CodeSamples/datastruct/Issaquah/existence.c | 6 ------ CodeSamples/datastruct/Issaquah/existence.h | 7 ++++++- CodeSamples/datastruct/Issaquah/existence_test.c | 3 --- CodeSamples/datastruct/Issaquah/tree.c | 6 ------ CodeSamples/datastruct/hash/Makefile | 7 +++++-- CodeSamples/defer/Makefile | 7 +++++-- CodeSamples/defer/hazptr.h | 6 +++++- CodeSamples/intro/Makefile | 12 ++++++------ CodeSamples/locking/Makefile | 6 +++--- 17 files changed, 66 insertions(+), 46 deletions(-) base-commit: 41e6a800d630336b1d8e614b3d11281e42e880c7 -- 2.34.1