Skip to contentSkip to conversation

KVM: s390: selftests: work around macro is_signed_type re-definiton

RFC PATCH New Michael Mueller 1 participant 1 message Jul 22, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 KVM: s390: selftests: work around macro is_signed_type re-definiton

The following commit creates a pre-processor warning during the KVM selftest build as it leads to a re-definition of macro is_signed_type().

commit fc92099902fb ("tools headers: Synchronize linux/bits.h with the kernel sources")

  $ make -C tools/testing/selftests TARGETS="kvm" all >/dev/null
  In file included from s390/ucontrol_test.c:11:
  ../kselftest_harness.h:754:9: warning: ‘is_signed_type’ redefined
    754 | #define is_signed_type(var)       (!!(((__typeof__(var))(-1)) < (__typeof__(var))1))
        |         ^~~~~~~~~~~~~~
  In file included from ./linux/tools/testing/selftests/../../../tools/include/linux/bits.h:34,
                   from ./linux/tools/testing/selftests/../../../tools/include/linux/bitops.h:14,
                   from ./linux/tools/testing/selftests/../../../tools/include/linux/hashtable.h:13,
                   from include/kvm_util.h:11,
                   from include/s390/debug_print.h:15,
                   from s390/ucontrol_test.c:10:
  ./linux/tools/testing/selftests/../../../tools/include/linux/overflow.h:31:9: note: this is the location of the previous definition
     31 | #define is_signed_type(type)       (((type)(-1)) < (type)1)
     	|         ^~~~~~~~~~~~~~
  cc1: note: unrecognized command-line option ‘-Wno-gnu-variable-sized-type-not-at-end’ may have been intended to silence earlier diagnostics

A fix resolving this issue outside this kvm selftest would be preferred.

---
 tools/testing/selftests/kvm/s390/ucontrol_test.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
tools/testing/selftests/kvm/s390/ucontrol_test.c +10 -0
index d265b34c54be..d1258c1568db 100644
@@ -8,6 +8,16 @@
  *  Christoph Schlameuss <[email protected]>
  */
 #include "debug_print.h"
+
+/*
+ * header debug_print.h leaves macro is_signed_type()
+ * behind which is defined in "linux/overflow.h"
+ * header "kselftest_harness.h" re-defines it.
+ */
+#ifdef is_signed_type
+#undef is_signed_type
+#endif
+
 #include "kselftest_harness.h"
 #include "kvm_util.h"
 #include "processor.h"
Signature · 1 line
2.50.1