warnings: catalog what we emit today, error on anything new

No warning is fixed here. Every one we currently emit is harvested and
switched off one by one, and /WX goes on top, so both toolchains build
quiet and any *new* warning fails the build instead of scrolling past.

cmake/Warnings.cmake carries two independent lists, one per compiler,
one line per warning with its occurrence count. Deleting a single line
is the unit of work from here on: drop the line, fix the fallout in
both compilers, commit. The build stays honest in the meantime.

Picking a level had to come first. CMake stopped injecting /W3 of its
own accord (policy CMP0092), which had quietly left MSVC on the /W1
default and hid nearly everything; at /W4 it reports 89361 warnings
across 31 codes. clang-cl is pinned to /W3 -- clang's own -Wall, and
already broader than MSVC /W4 -- for 55 more. The two lists are not
comparable by length.

Counts cover all four applications, since the #ifdef forest means each
one compiles different code. The file is included after the ext/
subdirectories so that add_compile_options' directory scope leaves
vendored code on its default flags; ext/ still warns, deliberately,
and /WX does not reach it.

The existing /wd4838 moves here with the rest.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Marco Antonio J. Costa
2026-07-27 15:56:01 -03:00
committed by majcosta
co-authored by Claude Opus 5
parent f7faa076a9
commit ee4a6b1149
2 changed files with 117 additions and 8 deletions
+3 -8
View File
@@ -42,14 +42,6 @@ if(ADDRESS_SANITIZER)
add_compile_options($<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,-fsanitize=address,>)
endif()
if(MSVC)
# TODO: fix the warnings here and turn them on
# https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-c4000-through-c4199
add_compile_options("/wd4838") # silence implicit narrowing conversion warnings
# add_compile_options("/w14061")
# add_compile_options("/w14062")
endif()
# whether we are using MSBuild as a generator
set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>)
@@ -87,6 +79,9 @@ add_subdirectory("ext/zlib")
add_subdirectory("ext/VFS")
target_link_libraries(bfVFS PRIVATE 7z)
# from here on down our own code only: vendored code above keeps default flags
include(cmake/Warnings.cmake)
# ja2export utility
add_subdirectory("export/src")