Skip to content

v0.11.0 — CMake's module scan off and -g1 Debug info by default, as inputs

Choose a tag to compare

@rhalbersma rhalbersma released this 03 Oct 13:03
· 32 commits to main since this release
b5161ff

Two new workflow_call inputs set how much a build writes rather than what it
checks. Both default to the lean side, so a caller gets them by bumping its pin,
and one repository can opt back to test the other setting (#56).

Input Default Passed as Taken by
scan_for_modules false -DCMAKE_CXX_SCAN_FOR_MODULES every workflow that configures and builds
debug_flags -g1 -DCMAKE_CXX_FLAGS_DEBUG; empty passes nothing gcc, clang, clang-libc++, apple-clang, mingw, sanitizers, coverage, codeql

Both are passed ahead of cmake_args, so a -D there still wins.

Why

CMake 3.28 and later scans every translation unit of a C++20 target for the
modules it imports. For a project that imports none, that is a preprocessor pass
per unit, and a fully preprocessed copy of each left in the build tree.

-g1 keeps the line tables and function names that a symbolized sanitizer
backtrace reads. It drops the variable and type information that only a
debugger uses, and no job here attaches one.

Measured on xstd-bits, 8 test targets, GCC 16 Debug with ASan and UBSan:

Variant Build tree Objects Executables Scan files
scan on, -g (v0.10.3) 499 MB 265 MB 202 MB 55 MB
scan off, -g 448 MB 265 MB 202 MB 0
scan off, -g1 (v0.11.0) 391 MB 230 MB 178 MB 0

Across that library's full 153 test units, the scan alone accounted for about
740 MB per build directory.

What else changed

  • sanitizers.yml and coverage.yml no longer hard-code -g. CMake places
    CMAKE_CXX_FLAGS_DEBUG after CMAKE_CXX_FLAGS, so -g1 overrode that -g
    anyway. gcov reads .gcno and .gcda, not DWARF.
  • clang-tidy.yml keeps the module scan fixed off, with no input. It
    configures without building, so a scan would leave module-map references
    in the compile database that are never written.
  • visual-studio.yml and msvc-analyze.yml take scan_for_modules only.
    MSVC's debug options are /Zi-style.
  • consumption.yml takes scan_for_modules only. It builds no Debug
    configuration.

To opt back

with:
  scan_for_modules: true   # scan every translation unit for module imports
  debug_flags: ""          # CMake's own -g

No check names change

The ladders resolve exactly as in v0.10.3, and no required check needs
renaming. The full xstd-bits matrix passed against this commit before the
merge (rhalbersma/xstd-bits#320).