clang-tidy: effective config with warnings-as-errors#537
Draft
andiwand wants to merge 3 commits into
Draft
Conversation
7ea4ab0 to
ee4b884
Compare
4066a56 to
1a1b045
Compare
…vers Stage 1 (code → Unicode extraction) is functionally done: 1.1 (ToUnicode multi-byte), 1.2 (simple-font /Encoding + AGL) and 1.3 (Type0 + Identity + /ToUnicode + predefined Unicode CMaps) all landed and cover the corpus. The nothing-implementable-now remainder is moved out of stage 1: - legacy CJK code→CID CMaps + CID→Unicode tables → tracked under Other known gaps (large data; generator scaffolding already landed), - embedded-font reverse map (was 1.4) → folded into stage 3 (font reading), - "no Unicode" run marking + /ActualText (was 1.5) → folded into stage 2. Stage 1 now reads as a goal + achieved summary. Updated the few code comments that referenced the relocated sub-stage numbers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The roadmap sub-stage numbers (stage 1.1/1.2/1.3, part A/part B) tagged onto code and test comments only said which roadmap sub-stage implemented a line; the technical explanation stands on its own, and the numbering now lives only in the roadmap. Strip them, keeping each comment's substance and the live "stage 2"/"stage 3" forward pointers. Comment-only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rework .clang-tidy from the stale CLion template into a high-signal config and make the tree clean under it. Config: - enable bugprone-*, clang-analyzer-*, performance-*, portability-* - disable convention-conflicting / high-noise checks (avoid-pragma-once, easily-swappable-parameters, narrowing-conversions, enum-size) - WarningsAsErrors: '*' (clang-analyzer-* kept advisory: its only findings are inside third-party -isystem headers) - drop the removed AnalyzeTemporaryDtors key that made clang-tidy reject the whole file on every run - test/.clang-tidy disables unchecked-optional-access for tests, where gtest assertion macros defeat the dataflow analysis (false positives only) Code fixes (all 148 source findings): - performance-avoid-endl: std::endl -> '\n' - bugprone-implicit-widening-of-multiplication-result: widen before multiply - bugprone-forward-declaration-namespace: drop dead/wrong-namespace fwd decls - bugprone-reserved-identifier: rename __ throwaways; NOLINT wvware's struct - bugprone-empty-catch: NOLINT intentional best-effort catches - bugprone-exception-escape: drop noexcept where functions can throw (string/ path allocation); keep move ops noexcept; wrap CLI main() in try/catch - bugprone-unchecked-optional-access: store re-fetched accessors, key ternaries on the optional, add a decryptor guard; NOLINT genuine invariants - misc: inefficient-string-concatenation, unused-local, unsafe-functions (rewind -> fseek), optional-value-conversion, macro-parentheses, branch-clone Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ee4b884 to
95520c8
Compare
1a1b045 to
5721443
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.
What
Reworks
.clang-tidyfrom the stale CLion template into a high-signal config withWarningsAsErrors, and makes the tree clean under it (all 148 source findings fixed).Based on
pdf-plan-stage1-wrapup(not main) because 8 of the touched files carry unmerged PDF stage-1 changes; retarget to main once that lands.Config
bugprone-*,clang-analyzer-*,performance-*,portability-*.avoid-pragma-once,easily-swappable-parameters,narrowing-conversions,enum-size.WarningsAsErrors: '*', butclang-analyzer-*is kept advisory — its only findings are inside third-party-isystemheaders (cryptopp/httplib/csv) we can't patch.AnalyzeTemporaryDtorskey, which made clang-tidy reject the whole config on every run (the original "noise").test/.clang-tidydisablesunchecked-optional-accessfor tests, where gtest assertion macros defeat the dataflow analysis (false positives only).Notable code changes
bugprone-exception-escape: droppednoexceptfrom functions that can throw (std::string/filesystem::pathallocation), including public API (odr::version,*_to_string,Pathaccessors). Move ops staynoexcept. CLImain()s wrapped in try/catch.unchecked-optional-access: real restructures (store re-fetched accessors, key ternaries on the optional, add a decryptor guard);NOLINTonly for genuine invariants.std::endl→'\n', widen-before-multiply, dead forward-decl removal,rewind→fseek, string-concat via append, etc.Verification
HtmlOutputTests.html_meta/*failures observed locally appear pre-existing on this branch (empty meta output, unrelated to these changes).🤖 Generated with Claude Code