feat: enable strict compilation with maximum warnings as errors#13
Merged
Conversation
- Add MORPH_ENABLE_STRICT_COMPILATION option (default ON) - Enable -Werror and ~60 additional warning flags across GCC, Clang, MSVC - Move shared diagnostics (Wshadow, -Wconversion, etc.) from Clang-only to the common GNU/Clang baseline - Fix all warnings surfaced by the new flags: - Add missing default: labels in switch statements - Remove empty @Par Example paragraphs from doxygen docs - Suppress -Wfloat-equal in tests with intentional float comparisons - Mark bridge-registered helper methods as [[maybe_unused]] - Suppress GCC -Wpedantic on __int128 extension usage - Remove redundant static_cast on size_t in session_auth.hpp - Add missing .roles and .idempotencyKey fields in designated initializers
- datetime.hpp: rename 'text'→'str' to avoid -Wshadow on glz::text - test_model.cpp: guard #pragma clang diagnostic with __clang__ - remote.hpp: noexcept on non-throwing lambda (-Wnoexcept) - src/main.cpp: noexcept on non-throwing lambda (-Wnoexcept)
- backend.hpp: rename lambda capture h to avoid -Wshadow on structured binding - compiler_options.cmake: drop -Wnoexcept (GCC 14 ICE on glaze templates + false positives on every std::function test lambda) - offline_queue.hpp: suppress -Woverloaded-virtual on enqueue two-arg overload - session_auth.hpp: explicit uint8_t cast for xor result (-Wconversion) - test_subscription.cpp: rename lambda param to avoid -Wshadow
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
- compiler_options.cmake: drop -Warray-bounds=2 and -Wstringop-overflow=4 (GCC 14 ICE on glaze templates); add clang-cl suppressions for covered-switch-default, documentation-unknown-command, padded, unique-object-duplication, c2y-extensions, missing-noreturn; add _CRT_SECURE_NO_WARNINGS for MSVC - logger.hpp: remove backtick-wrapped escape sequences from doxygen comments to avoid clang -Wdocumentation-unknown-command - ci.yml: pass -warnings-as-errors=* to clang-tidy via -extra-arg (clang-tidy-diff.py doesn't recognize the flag directly)
…r -Wall - -Wrestrict triggers GCC 14 ICE on glaze template instantiations - clang-cl -Wno-* suppressions must come after -Wall/-Wextra in the same compile_options call, otherwise -Wall re-enables the warnings
Yaraslaut
force-pushed
the
improvement/strict-compilation
branch
5 times, most recently
from
July 19, 2026 09:02
e163228 to
9edc587
Compare
- Install GCC 15 from ubuntu-toolchain-r/test PPA - Install Clang 22 from apt.llvm.org - Update all jobs: linux-compilers, linux-qt, valgrind, docs
Yaraslaut
force-pushed
the
improvement/strict-compilation
branch
from
July 19, 2026 09:34
9edc587 to
a347641
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
MORPH_ENABLE_STRICT_COMPILATIONoption (defaultON) that enables-Werrorand ~60 additional warning flags across GCC, Clang, and MSVC. The CI gets this automatically; users can opt out with-DMORPH_ENABLE_STRICT_COMPILATION=OFF.Changes
CMake infrastructure
MORPH_ENABLE_STRICT_COMPILATION(defaultON, controlled by the option in case someone can't avoid warnings)apply_warnings()now adds-Werror//WXand ~60 extra flags when strict mode is on-Wshadow,-Wconversion,-Wsign-conversion,-Wnull-dereference,-Wimplicit-fallthrough, and others from Clang-only to the common GNU/Clang baseline (GCC also supports them)Warnings surfaced & fixed
default:labels to 5 exhaustive switch statements@par Exampleparagraphs from doxygen comments (Clang-Wdocumentation)@tparam/ on concepts: Clang's-Wdocumentationdoesn't accept either on concepts — replaced with inline text-Wfloat-equalin test files with intentional float comparisonsfromJson/toJson) as[[maybe_unused]]unsigned __int128extension warning with pragmastatic_cast<uint64_t>onsize_t.roles = {}and.idempotencyKey = {}to initializersVerification