]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commit
src: Add sign-compare warnings to clang
authorAlex Ainscow <aainscow@uk.ibm.com>
Wed, 13 Aug 2025 11:03:21 +0000 (12:03 +0100)
committerAlex Ainscow <aainscow@uk.ibm.com>
Wed, 20 Aug 2025 06:43:59 +0000 (07:43 +0100)
commit3a7e06ca48f4b42bbacb70ea7f59bf09d6aa0b13
tree0e922da28640c6c9052ffdd6f0ec33370ff35416
parent50342c1e040801ee3df949f17b747b91d9bd2178
src: Add sign-compare warnings to clang

For a while, GCC has generated warnings about sign errors. A common
mistake if compiling with clang was to accidentally introduce signedness
errors, which were picked up by the GCC builds.

This occurs due to an inconsistency in -Wall implementation between clang
and gcc: gcc includes sign-compare, clang does not.

See:
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wall
vs
https://clang.llvm.org/docs/DiagnosticsReference.html#wall

Note that sign-compare is included under -Wextra for clang:
https://clang.llvm.org/docs/DiagnosticsReference.html#wextra

Clang will now generate similar warnings with -Wsign-compare:
https://clang.llvm.org/docs/DiagnosticsReference.html#wsign-compare

Interestingly, if specified on its own, -Wsign-compare will include
C, whereas gcc -Wall affects C++ only. Therefore we must work around
this in the make file to emulate the GCC behaviour in clang builds.

Also fix a couple of warnings found in some tests.

Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
src/CMakeLists.txt
src/test/osd/TestECBackend.cc
src/test/osd/test_scrubber_be.cc