Merge bitcoin/bitcoin#32482: build: add -W*-whitespace

40dcbf580d build: add -Wtrailing-whitespace=any (fanquake)
d7659cd7e6 build: add -Wleading-whitespace=spaces (fanquake)
d86650220a cmake: Disable `-Wtrailing-whitespace` warnings for RCC-generated files (Hennadii Stepanov)
aabc5ca6ed cmake: Switch from AUTORCC to `qt6_add_resources` (Hennadii Stepanov)
25ae14c339 subprocess: replace tab with space (fanquake)
0c2b9dadd5 scripted-diff: remove whitespace in sha256_sse4.cpp (fanquake)
4da084fbc9 scripted-diff: change whitespace to spaces in univalue (fanquake)
e6caf150b3 ci: add moreutils to lint job (fanquake)

Pull request description:

  GCC 15 now has options to turn leading & trailing whitespace into compile failures: https://gcc.gnu.org/gcc-15/changes.html#c-family. Fix the few cases of leading tabs, and trailing whitespace, and then enable `-Wleading-whitespace` and `-Wtrailing-whitespace`.

  We currently get PRs that are opened with various whitespace, i.e #33822, so turning that into compile-time failure where possible, seems useful, to avoid a CI roundtrip.

ACKs for top commit:
  ajtowns:
    utACK 40dcbf580d
  hebasto:
    re-ACK 40dcbf580d.

Tree-SHA512: a128001ab2abb41cd6d249dcf46be4167ebd608d6b0f1452212a3ec9a383747bea623ab0382ec7bc0ac7a232a47cca5174e1cd73d4eda6751aa3cb2365ad2ede
This commit is contained in:
merge-script committed 2025-11-12 10:53:42 +00:00
commit d0da953773
3 files changed
+15 -4

No files matched your search

+2
View File
@@ -463,6 +463,8 @@ else()
try_append_cxx_flags("-Wself-assign" TARGET warn_interface SKIP_LINK) try_append_cxx_flags("-Wself-assign" TARGET warn_interface SKIP_LINK)
try_append_cxx_flags("-Wbidi-chars=any" TARGET warn_interface SKIP_LINK) try_append_cxx_flags("-Wbidi-chars=any" TARGET warn_interface SKIP_LINK)
try_append_cxx_flags("-Wundef" TARGET warn_interface SKIP_LINK) try_append_cxx_flags("-Wundef" TARGET warn_interface SKIP_LINK)
try_append_cxx_flags("-Wleading-whitespace=spaces" TARGET warn_interface SKIP_LINK)
try_append_cxx_flags("-Wtrailing-whitespace=any" TARGET warn_interface SKIP_LINK)
# Some compilers (gcc) ignore unknown -Wno-* options, but warn about all # Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
# unknown options if any other warning is produced. Test the -Wfoo case, and # unknown options if any other warning is produced. Test the -Wfoo case, and
+2 -1
View File
@@ -18,7 +18,8 @@ ${CI_RETRY_EXE} apt-get update
# - curl/xz-utils (to install shellcheck) # - curl/xz-utils (to install shellcheck)
# - git (used in many lint scripts) # - git (used in many lint scripts)
# - gpg (used by verify-commits) # - gpg (used by verify-commits)
${CI_RETRY_EXE} apt-get install -y cargo curl xz-utils git gpg # - moreutils (used by scripted-diff)
${CI_RETRY_EXE} apt-get install -y cargo curl xz-utils git gpg moreutils
PYTHON_PATH="/python_build" PYTHON_PATH="/python_build"
if [ ! -d "${PYTHON_PATH}/bin" ]; then if [ ! -d "${PYTHON_PATH}/bin" ]; then
+11 -3
View File
@@ -50,11 +50,19 @@ endfunction()
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOMOC_MOC_OPTIONS "-p${CMAKE_CURRENT_SOURCE_DIR}") set(CMAKE_AUTOMOC_MOC_OPTIONS "-p${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOUIC_SEARCH_PATHS forms) set(CMAKE_AUTOUIC_SEARCH_PATHS forms)
set(CMAKE_AUTORCC OFF)
configure_file(bitcoin_locale.qrc bitcoin_locale.qrc USE_SOURCE_PERMISSIONS COPYONLY) configure_file(bitcoin_locale.qrc bitcoin_locale.qrc USE_SOURCE_PERMISSIONS COPYONLY)
qt6_add_resources(BITCOIN_QRC bitcoin.qrc)
qt6_add_resources(BITCOIN_LOCALE_QRC ${CMAKE_CURRENT_BINARY_DIR}/bitcoin_locale.qrc)
# See: https://bugreports.qt.io/browse/QTBUG-141858.
get_target_property(warn_flags warn_interface INTERFACE_COMPILE_OPTIONS)
if("-Wtrailing-whitespace=any" IN_LIST warn_flags)
set_source_files_properties(${BITCOIN_QRC} ${BITCOIN_LOCALE_QRC} PROPERTIES COMPILE_OPTIONS -Wno-trailing-whitespace)
endif()
unset(warn_flags)
# The bitcoinqt sources have to include headers in # The bitcoinqt sources have to include headers in
# order to parse them to collect translatable strings. # order to parse them to collect translatable strings.
@@ -119,8 +127,8 @@ add_library(bitcoinqt STATIC EXCLUDE_FROM_ALL
utilitydialog.h utilitydialog.h
$<$<PLATFORM_ID:Windows>:winshutdownmonitor.cpp> $<$<PLATFORM_ID:Windows>:winshutdownmonitor.cpp>
$<$<PLATFORM_ID:Windows>:winshutdownmonitor.h> $<$<PLATFORM_ID:Windows>:winshutdownmonitor.h>
bitcoin.qrc ${BITCOIN_QRC}
${CMAKE_CURRENT_BINARY_DIR}/bitcoin_locale.qrc ${BITCOIN_LOCALE_QRC}
) )
target_compile_definitions(bitcoinqt target_compile_definitions(bitcoinqt
PUBLIC PUBLIC