Per https://reviews.llvm.org/D66046, patch to move -Wtautological-compare to -Wmost, which also adds it to -Wall. Some warnings in -Wtautological-compare and its diagnostic sub-groups are DefaultIgnore, so making them visible in -Wall will make them more discoverable overall.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looking at the various warnings in -Wtautological-compare, only -Wtautological-overlap-compare and -Wtautological-bitwise-compare are not on by default. During my last try with those, they were very high value, and had low or no false posivites.
@xbolva00 linked to someone testing out -Wtautological-compare. The results don't show any warnings from the bitwise or overlap warnings.
Would this be better if we had a specific test to verify all the warning groups in -Wall? I could see something using diagtool to list and check all the warnings.
This is imho basic enough that it doesn't need a test. A test for this doesn't add any value that I can see.
The value comes from having an explicit test to demonstrate the behavior is not an accident, so when someone asks "is this behavior intentional?" the answer is more obvious from the test.
Yeah, I think that would be better but I don't think the full -Wall testing is necessary for this change. I was mostly hoping for a trivial test that shows -Wall is sufficient to enable at least one of the tautological checks that was previously disabled.
Just use
// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s // RUN: %clang_cc1 -fsyntax-only -verify -Wtautological-bitwise-compare %s
in
clang/test/SemaCXX/warn-bitwise-compare.cpp
?
Add -Wall tests to check that certain warning groups are active with it and a test to check all warning groups that are turned on by -Wall.
This broke the libcxx test suite:
FAIL: libc++ :: libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp (50769 of 59296) ******************** TEST 'libc++ :: libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp' FAILED ******************** Command: ['/p/tllvm/bin/clang++', '-o', '/tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers/Output/db_sequence_container_iterators.multithread.pass.cpp.o', '-x', 'c++', '/home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp', '-c', '-v', '-ftemplate-depth=270', '-Werror=thread-safety', '-std=c++2a', '-include', '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', '-I/home/dave/s/lp/libcxx/include', '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', '-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python /home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py"', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', '-Wno-unused-command-line-argument', '-Wno-attributes', '-Wno-constant-evaluated', '-Wno-pessimizing-move', '-Wno-c++11-extensions', '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] Exit Code: 1 Standard Error: -- clang version 10.0.0 (https://github.com/llvm/llvm-project.git d8b6b1114307558a5245de3806bb70f53f6f3efe) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /p/tllvm/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/p/tllvm/bin/clang-10" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name db_sequence_container_iterators.multithread.pass.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -nostdinc++ -resource-dir /p/tllvm/lib64/clang/10.0.0 -include /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I /home/dave/s/lp/libcxx/include -I /tmp/_update_lc/t/projects/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /home/dave/s/lp/libcxx/test/support -D "LIBCXX_FILESYSTEM_STATIC_TEST_ROOT=\"/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=\"/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER=\"/usr/bin/python /home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py\"" -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /usr/local/include -internal-isystem /p/tllvm/lib64/clang/10.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror=thread-safety -Wall -Wextra -Werror -Wuser-defined-warnings -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-constant-evaluated -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -std=c++2a -fdeprecated-macro -fdebug-compilation-dir /tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers -ftemplate-depth 270 -ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fno-implicit-modules -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -faddrsig -o /tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers/Output/db_sequence_container_iterators.multithread.pass.cpp.o -x c++ /home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp clang -cc1 version 10.0.0 based upon LLVM 10.0.0git default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /home/dave/s/lp/libcxx/include /tmp/_update_lc/t/projects/libcxx/include/c++build /home/dave/s/lp/libcxx/test/support /usr/local/include /p/tllvm/lib64/clang/10.0.0/include /usr/include End of search list. In file included from /home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp:27: /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:66:26: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_Vector >= CT && CT_ForwardList <= CT; ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:70:23: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_Map >= CT && CT_MultiSet <= CT; ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:74:32: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_UnorderedMap >= CT && CT_UnorderedMultiSet <= CT; ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 errors generated. -- Compilation failed unexpectedly! ******************** Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80 FAIL: libc++ :: libcxx/debug/containers/db_string.pass.cpp (50797 of 59296) ******************** TEST 'libc++ :: libcxx/debug/containers/db_string.pass.cpp' FAILED ******************** Command: ['/p/tllvm/bin/clang++', '-o', '/tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers/Output/db_string.pass.cpp.o', '-x', 'c++', '/home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_string.pass.cpp', '-c', '-v', '-ftemplate-depth=270', '-Werror=thread-safety', '-std=c++2a', '-include', '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', '-I/home/dave/s/lp/libcxx/include', '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', '-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python /home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py"', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', '-Wno-unused-command-line-argument', '-Wno-attributes', '-Wno-constant-evaluated', '-Wno-pessimizing-move', '-Wno-c++11-extensions', '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] Exit Code: 1 Standard Error: -- clang version 10.0.0 (https://github.com/llvm/llvm-project.git d8b6b1114307558a5245de3806bb70f53f6f3efe) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /p/tllvm/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/p/tllvm/bin/clang-10" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name db_string.pass.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -nostdinc++ -resource-dir /p/tllvm/lib64/clang/10.0.0 -include /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I /home/dave/s/lp/libcxx/include -I /tmp/_update_lc/t/projects/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /home/dave/s/lp/libcxx/test/support -D "LIBCXX_FILESYSTEM_STATIC_TEST_ROOT=\"/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=\"/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER=\"/usr/bin/python /home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py\"" -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /usr/local/include -internal-isystem /p/tllvm/lib64/clang/10.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror=thread-safety -Wall -Wextra -Werror -Wuser-defined-warnings -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-constant-evaluated -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -std=c++2a -fdeprecated-macro -fdebug-compilation-dir /tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers -ftemplate-depth 270 -ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fno-implicit-modules -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -faddrsig -o /tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers/Output/db_string.pass.cpp.o -x c++ /home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_string.pass.cpp clang -cc1 version 10.0.0 based upon LLVM 10.0.0git default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /home/dave/s/lp/libcxx/include /tmp/_update_lc/t/projects/libcxx/include/c++build /home/dave/s/lp/libcxx/test/support /usr/local/include /p/tllvm/lib64/clang/10.0.0/include /usr/include End of search list. In file included from /home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_string.pass.cpp:24: /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:66:26: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_Vector >= CT && CT_ForwardList <= CT; ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:70:23: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_Map >= CT && CT_MultiSet <= CT; ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:74:32: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_UnorderedMap >= CT && CT_UnorderedMultiSet <= CT; ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 errors generated. -- Compilation failed unexpectedly! ******************** Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80 FAIL: libc++ :: libcxx/debug/containers/db_associative_container_tests.pass.cpp (50852 of 59296) ******************** TEST 'libc++ :: libcxx/debug/containers/db_associative_container_tests.pass.cpp' FAILED ******************** Command: ['/p/tllvm/bin/clang++', '-o', '/tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers/Output/db_associative_container_tests.pass.cpp.o', '-x', 'c++', '/home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp', '-c', '-v', '-ftemplate-depth=270', '-Werror=thread-safety', '-std=c++2a', '-include', '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', '-I/home/dave/s/lp/libcxx/include', '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', '-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python /home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py"', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', '-Wno-unused-command-line-argument', '-Wno-attributes', '-Wno-constant-evaluated', '-Wno-pessimizing-move', '-Wno-c++11-extensions', '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] Exit Code: 1 Standard Error: -- clang version 10.0.0 (https://github.com/llvm/llvm-project.git d8b6b1114307558a5245de3806bb70f53f6f3efe) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /p/tllvm/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/p/tllvm/bin/clang-10" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name db_associative_container_tests.pass.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -nostdinc++ -resource-dir /p/tllvm/lib64/clang/10.0.0 -include /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I /home/dave/s/lp/libcxx/include -I /tmp/_update_lc/t/projects/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /home/dave/s/lp/libcxx/test/support -D "LIBCXX_FILESYSTEM_STATIC_TEST_ROOT=\"/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=\"/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER=\"/usr/bin/python /home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py\"" -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /usr/local/include -internal-isystem /p/tllvm/lib64/clang/10.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror=thread-safety -Wall -Wextra -Werror -Wuser-defined-warnings -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-constant-evaluated -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -std=c++2a -fdeprecated-macro -fdebug-compilation-dir /tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers -ftemplate-depth 270 -ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fno-implicit-modules -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -faddrsig -o /tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers/Output/db_associative_container_tests.pass.cpp.o -x c++ /home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp clang -cc1 version 10.0.0 based upon LLVM 10.0.0git default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /home/dave/s/lp/libcxx/include /tmp/_update_lc/t/projects/libcxx/include/c++build /home/dave/s/lp/libcxx/test/support /usr/local/include /p/tllvm/lib64/clang/10.0.0/include /usr/include End of search list. In file included from /home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp:25: /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:66:26: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_Vector >= CT && CT_ForwardList <= CT; ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:70:23: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_Map >= CT && CT_MultiSet <= CT; ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:74:32: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_UnorderedMap >= CT && CT_UnorderedMultiSet <= CT; ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 errors generated. -- Compilation failed unexpectedly! ******************** Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80 FAIL: libc++ :: libcxx/debug/containers/db_unord_container_tests.pass.cpp (50856 of 59296) ******************** TEST 'libc++ :: libcxx/debug/containers/db_unord_container_tests.pass.cpp' FAILED ******************** Command: ['/p/tllvm/bin/clang++', '-o', '/tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers/Output/db_unord_container_tests.pass.cpp.o', '-x', 'c++', '/home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp', '-c', '-v', '-ftemplate-depth=270', '-Werror=thread-safety', '-std=c++2a', '-include', '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', '-I/home/dave/s/lp/libcxx/include', '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', '-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python /home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py"', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', '-Wno-unused-command-line-argument', '-Wno-attributes', '-Wno-constant-evaluated', '-Wno-pessimizing-move', '-Wno-c++11-extensions', '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] Exit Code: 1 Standard Error: -- clang version 10.0.0 (https://github.com/llvm/llvm-project.git d8b6b1114307558a5245de3806bb70f53f6f3efe) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /p/tllvm/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/p/tllvm/bin/clang-10" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name db_unord_container_tests.pass.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -nostdinc++ -resource-dir /p/tllvm/lib64/clang/10.0.0 -include /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I /home/dave/s/lp/libcxx/include -I /tmp/_update_lc/t/projects/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /home/dave/s/lp/libcxx/test/support -D "LIBCXX_FILESYSTEM_STATIC_TEST_ROOT=\"/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=\"/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER=\"/usr/bin/python /home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py\"" -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /usr/local/include -internal-isystem /p/tllvm/lib64/clang/10.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror=thread-safety -Wall -Wextra -Werror -Wuser-defined-warnings -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-constant-evaluated -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -std=c++2a -fdeprecated-macro -fdebug-compilation-dir /tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers -ftemplate-depth 270 -ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fno-implicit-modules -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -faddrsig -o /tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers/Output/db_unord_container_tests.pass.cpp.o -x c++ /home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp clang -cc1 version 10.0.0 based upon LLVM 10.0.0git default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /home/dave/s/lp/libcxx/include /tmp/_update_lc/t/projects/libcxx/include/c++build /home/dave/s/lp/libcxx/test/support /usr/local/include /p/tllvm/lib64/clang/10.0.0/include /usr/include End of search list. In file included from /home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp:24: /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:66:26: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_Vector >= CT && CT_ForwardList <= CT; ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:70:23: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_Map >= CT && CT_MultiSet <= CT; ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:74:32: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_UnorderedMap >= CT && CT_UnorderedMultiSet <= CT; ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 errors generated. -- Compilation failed unexpectedly! ******************** Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80 FAIL: libc++ :: libcxx/debug/containers/db_sequence_container_iterators.pass.cpp (50945 of 59296) ******************** TEST 'libc++ :: libcxx/debug/containers/db_sequence_container_iterators.pass.cpp' FAILED ******************** Command: ['/p/tllvm/bin/clang++', '-o', '/tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers/Output/db_sequence_container_iterators.pass.cpp.o', '-x', 'c++', '/home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp', '-c', '-v', '-ftemplate-depth=270', '-Werror=thread-safety', '-std=c++2a', '-include', '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', '-I/home/dave/s/lp/libcxx/include', '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', '-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python /home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py"', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', '-Wno-unused-command-line-argument', '-Wno-attributes', '-Wno-constant-evaluated', '-Wno-pessimizing-move', '-Wno-c++11-extensions', '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] Exit Code: 1 Standard Error: -- clang version 10.0.0 (https://github.com/llvm/llvm-project.git d8b6b1114307558a5245de3806bb70f53f6f3efe) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /p/tllvm/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/p/tllvm/bin/clang-10" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name db_sequence_container_iterators.pass.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -nostdinc++ -resource-dir /p/tllvm/lib64/clang/10.0.0 -include /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I /home/dave/s/lp/libcxx/include -I /tmp/_update_lc/t/projects/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /home/dave/s/lp/libcxx/test/support -D "LIBCXX_FILESYSTEM_STATIC_TEST_ROOT=\"/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=\"/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER=\"/usr/bin/python /home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py\"" -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /usr/local/include -internal-isystem /p/tllvm/lib64/clang/10.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror=thread-safety -Wall -Wextra -Werror -Wuser-defined-warnings -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-constant-evaluated -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -std=c++2a -fdeprecated-macro -fdebug-compilation-dir /tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers -ftemplate-depth 270 -ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fno-implicit-modules -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -faddrsig -o /tmp/_update_lc/t/projects/libcxx/test/libcxx/debug/containers/Output/db_sequence_container_iterators.pass.cpp.o -x c++ /home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp clang -cc1 version 10.0.0 based upon LLVM 10.0.0git default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /home/dave/s/lp/libcxx/include /tmp/_update_lc/t/projects/libcxx/include/c++build /home/dave/s/lp/libcxx/test/support /usr/local/include /p/tllvm/lib64/clang/10.0.0/include /usr/include End of search list. In file included from /home/dave/s/lp/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp:25: /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:66:26: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_Vector >= CT && CT_ForwardList <= CT; ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:70:23: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_Map >= CT && CT_MultiSet <= CT; ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ /home/dave/s/lp/libcxx/test/support/container_debug_tests.h:74:32: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] return CT_UnorderedMap >= CT && CT_UnorderedMultiSet <= CT; ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 errors generated. -- Compilation failed unexpectedly! ******************** Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 10 warning(s) in tests. Testing Time: 109.62s ******************** Failing Tests (5): libc++ :: libcxx/debug/containers/db_associative_container_tests.pass.cpp libc++ :: libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp libc++ :: libcxx/debug/containers/db_sequence_container_iterators.pass.cpp libc++ :: libcxx/debug/containers/db_string.pass.cpp libc++ :: libcxx/debug/containers/db_unord_container_tests.pass.cpp Expected Passes : 43467 Expected Failures : 103 Unsupported Tests : 15721 Unexpected Failures: 5
Sorry I'm late to the party; I've been traveling for 3+ weeks.
I would like to be reassured that the following code will not warn:
` long foo = ...; // some calculation if (foo < std::numeric_limits<int>::min() || foo > std::numeric_limits<int>::max()) .....
This is important for systems where sizeof(int) == sizeof(long)
The question is whether there's a warning when a value is tautologically compared with the min or max of that value's type. They fall under -Wtype-limits or -Wtautological-constant-in-range-compare. Despite the "tautological" in the name, they do not fall under -Wtautological-compare. Therefore, your example code will not get any warnings with -Wall.
I checked the clang tests and this covered by test/Sema/tautological-constant-compare.c, testing both the warnings is active only when the specific warning groups are active (the #ifdef TEST sections) and that the warnings are off for no warning flags, just -Wextra, and just -Wall.