From 4fbc14e698938e398964b525bbe9ced7a7af0a54 Mon Sep 17 00:00:00 2001 From: poli0981 <127664709+poli0981@users.noreply.github.com> Date: Wed, 11 Nov 2026 09:27:27 +0700 Subject: [PATCH] ci: Qodana reads the C++ as a second report - a Visual Studio solution CMake writes, the job `native`, fifty-four .editorconfig lines each with its reason, eleven small fixes, nothing changed in code loaded into a game (Qodana PR-2, D99/D100) (#385) The second of two pull requests. Qodana for .NET - whose C++ is ReSharper C++ - is the only linter of JetBrains' that can read this code: it is MSVC-only, and qodana-cpp and qodana-clang are Linux images. It reads C++ through a Visual Studio solution, and src/native is a CMake tree, so the job has CMake write one. The job - src/native/CMakePresets.json: the preset x64-vs-analysis (generator "Visual Studio 18 2026", tests and tools on). Nothing ships from it, and the gate and the release never use it. - qodana-native.yaml: the solution, RelWithDebInfo and x64; the build tree, third_party, the vendor stubs and a compiled shader left out by path; a gate of zero. - qodana.yml: the job `native` - configure, build the one target whose output is a header (the blocklist floor), then the action with --config qodana-native.yaml. Its own results folder, cache keys, artifact (qodana-report-native) and Qodana Cloud project (frameledger-cpp, QODANA_TOKEN_NATIVE). No comment and no annotations: the pull request's are the managed job's. Advisory. What its first run reported, and what was done (docs/13_CI_CD.md, section Qodana) - 4,695 problems, 4,040 of them hints (off, as on the managed side). Of the 655 left, 494 are distinct: a file compiled into three targets is reported three times. - Off in .editorconfig, each with its reason - every clang-tidy check and clang diagnostic the engine runs has a key of ReSharper's, so no .clang-tidy file is added: 278 a choice this code made (struct padding, MSVC's keywords, a function pointer got by name cast to its type, "can be const / constexpr / static", an #include of what the file uses); 53 a newer idiom proposed for working code; 25 the engine misreading std::atomic_ref, zero-initialised API structures and tests of constexpr functions; 25 fields nothing names in structures Windows defines (four files); 19 %lu with NvU32 in one probe - unsigned int only under clang, the linter's compiler; 78 what a probe or a test does on purpose (tools and tests); 7 in code loaded into a game, kept as it is. - Fixed, 11, none changing what a shipped binary does: std::size for four hand-written array lengths; two multiplications done in a narrower type than their result (a constant in the guard's sources, a test); two unused member functions, an unused type alias and two unused includes in the tests and the probes. Code loaded into a game - the Overlay, the Vulkan layer, the shared-memory headers, the guard's rule matcher - is not changed (D100: there only a defect is fixed, and the report found none). One thing there is not as it should be and is RECORDED, not removed: dllmain.cpp's LogNoteW, which nothing calls. .editorconfig leaves that one file unread for an unused function, in a section that says to remove it with the function; whether it goes is the owner's call (HANDOFF). "Zero" proved to mean "analysed": a branch that put back three of the things fixed here was reported with exactly those three, by the inspections that had found them (run 42942390715). Runs on this branch: 42942068024 (one problem left: LogNoteW), 42943094415 (none). Docs: 13_CI_CD (the native report), 12_BUILD (the preset), CLAUDE.md (the layout, the C++ conventions), HANDOFF, wiki/Releasing, CHANGELOG. Co-authored-by: Claude Fable 5.2 --- .editorconfig | 139 ++++++++++++++++++ .github/workflows/qodana.yml | 69 +++++++++ CHANGELOG.md | 38 +++-- CLAUDE.md | 4 +- docs/12_BUILD.md | 5 + docs/13_CI_CD.md | 78 +++++++++- docs/HANDOFF.md | 43 +++++- qodana-native.yaml | 45 ++++++ src/native/CMakePresets.json | 15 +- .../src/fl_guard_sources.cpp | 2 +- src/native/tests/nvapi_bridge_test.cpp | 5 +- src/native/tests/ring_test.cpp | 4 +- src/native/tools/fl-probe-interposer/main.cpp | 1 - src/native/tools/fl-probe-signer/main.cpp | 3 - src/native/tools/hook-harness/main.cpp | 8 +- wiki/Releasing.md | 2 +- 16 files changed, 422 insertions(+), 39 deletions(-) create mode 100644 qodana-native.yaml diff --git a/.editorconfig b/.editorconfig index fc931329..cdab4d9f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -184,3 +184,142 @@ resharper_collection_never_updated_local_highlighting = none resharper_unused_method_return_value_local_highlighting = none resharper_redundant_assignment_highlighting = none resharper_return_type_can_be_not_nullable_highlighting = none + +# --- ReSharper C++ inspections: what Qodana's native report reads (docs/13_CI_CD.md §Qodana, D99 and D100) --- +# The native report runs ReSharper's C++ engine, and with it the clang-tidy checks and clang diagnostics that engine +# bundles (the keys that say clang_tidy). The native code is built by MSVC alone, with /W4 /WX; what clang says about +# code it never compiles is read here as advice. An inspection is off only where it argues with a choice this project +# made, and each line says which; everything else the report found was fixed. +[src/native/**.{cpp,h,inl}] +# Where the compiler pads a struct. Information, not a fault: the layouts that matter are asserted (static_assert on +# sizes and offsets in fl_shm.h, and the mirror test against fl-layout-dump). +resharper_cpp_clang_tidy_clang_diagnostic_padded_highlighting = none +# MSVC's own keywords - __try/__except (rule 5's guard around every hook body), __declspec, __stdcall. This code is +# built by MSVC and by nothing else. +resharper_cpp_clang_tidy_clang_diagnostic_language_extension_token_highlighting = none +# A function looked up by name - GetProcAddress, vkGetInstanceProcAddr, a vtable slot - comes back as a pointer to +# another function type and is cast to its real one: that is the API. Through void* is how the cast says it is meant. +resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none +resharper_cpp_clang_tidy_bugprone_casting_through_void_highlighting = none +# Memory read as something else - a COM object as its vtable, a relay's bytes as an address - says reinterpret_cast, +# also where static_cast from void* would compile. +resharper_cpp_reinterpret_cast_from_void_ptr_highlighting = none +# It proposes std::cmp_less for a comparison whose sides differ in sign. The comparisons it found cast one side +# explicitly, and the compiler's own sign warnings (C4018, C4388, C4389) are errors in this build. +resharper_cpp_clang_tidy_modernize_use_integer_sign_comparison_highlighting = none +# A `default:` under a switch that names every enumerator is deliberate: a value outside the enumeration - a corrupt +# one, a future one - takes the refusing arm instead of falling out of the switch. +resharper_cpp_clang_tidy_clang_diagnostic_covered_switch_default_highlighting = none +# "Not eliding copy on return": a verdict returned from a const local is copied. It is a few words wide. +resharper_cpp_clang_tidy_clang_diagnostic_nrvo_highlighting = none +# A type that owns a handle deletes its copies or declares none; the moves are then not generated either, which is +# what is wanted. Four more `= delete` lines would say nothing the destructor did not. +resharper_cpp_clang_tidy_cppcoreguidelines_special_member_functions_highlighting = none +# An enumeration zero-initialised (`D3D_FEATURE_LEVEL got{}`) is an out parameter cleared before the call that fills it. +resharper_cpp_clang_tidy_bugprone_invalid_enum_default_initialization_highlighting = none +# An enumeration's width is part of a layout or of the atomic word it is stored in, not a size to be minimised. +resharper_cpp_clang_tidy_performance_enum_size_highlighting = none +# "Possibly unused #include": a file that calls std::memset includes , also when already brought +# it in. What it reported was of that kind, or a header named again inside a conditional block, but for two that +# nothing used; those were removed. +resharper_cpp_unused_include_directive_highlighting = none +# A function another file calls by a declaration of its own (the harness's Hold* functions), an entry point the +# loader calls by name (DllMain), a placeholder a target links: "can be made static" reads one file. +resharper_cpp_use_internal_linkage_highlighting = none +# "Can be made const": a parameter or a method through which the code acts on a device, a ring or a handle is not +# const because the type system would allow it; and a local that is already const gains nothing from constexpr - for a +# std::string it would hold only while the text fits the small-string buffer. +resharper_cpp_parameter_may_be_const_ptr_or_ref_highlighting = none +resharper_cpp_member_function_may_be_const_highlighting = none +resharper_cpp_variable_can_be_made_constexpr_highlighting = none +# THE ENGINE MISREADS THESE. (1) `std::atomic_ref{x}.fetch_or(bit)` is reported as an expression without side +# effects; the side effect is the call. (2) A Win32, D3D12 or ffx-api structure is zero-initialised and then filled +# field by field - the reserved fields must stay zero - and is handed to the API by its address or its header's: the +# engine reports the initialiser as always rewritten and the fields as assigned and never used. (3) A test of a +# constexpr function (`Check(F(a) == b && G(a) == c, ...)`) has the engine evaluate it and call one side redundant. +resharper_cpp_expression_without_side_effects_highlighting = none +resharper_cpp_initialized_value_is_always_rewritten_highlighting = none +resharper_cpp_assigned_value_is_never_used_highlighting = none +resharper_cpp_redundant_boolean_expression_argument_highlighting = none +# Proposals to restate working code in a newer idiom - a range-for, std::ranges, any_of, starts_with, std::min, a raw +# string, an if with an initialiser, emplace_back. The native code is written to be read beside the hook path: an +# index and a plain loop, the same in the guard, its tests and the probes. +resharper_cpp_clang_tidy_modernize_loop_convert_highlighting = none +resharper_cpp_clang_tidy_modernize_use_ranges_highlighting = none +resharper_cpp_use_range_algorithm_highlighting = none +resharper_cpp_clang_tidy_readability_use_anyofallof_highlighting = none +resharper_cpp_clang_tidy_modernize_use_starts_ends_with_highlighting = none +resharper_cpp_clang_tidy_readability_use_std_min_max_highlighting = none +resharper_cpp_clang_tidy_modernize_raw_string_literal_highlighting = none +resharper_cpp_clang_tidy_modernize_use_emplace_highlighting = none +resharper_cpp_clang_tidy_modernize_return_braced_init_list_highlighting = none +resharper_cpp_use_associative_contains_highlighting = none +resharper_cpp_too_wide_scope_highlighting = none +resharper_cpp_if_can_be_replaced_by_constexpr_if_highlighting = none + +# A structure Windows defines and this SDK's headers do not give (RTL_PROCESS_MODULE_INFORMATION, +# PROCESS_MEMORY_COUNTERS_EX2), and a test's stand-in for a Vulkan dispatchable object, are declared field for field: +# the fields nothing names are what puts the others at their offsets. +[src/native/{FrameLedger.Injector/src/fl_guard_sources.cpp,FrameLedger.ProcessStats/src/fl_process_stats.cpp,tools/fl-probe-guard/main.cpp,tests/vklayer_test.cpp}] +resharper_cpp_declarator_never_used_highlighting = none + +# The linter's compiler, not the build's: NVAPI's header makes NvU32 `unsigned int` under clang and `unsigned long` +# under MSVC, which is the compiler that builds this probe - and `%lu` is right for it. +[src/native/tools/fl-probe-nvapi/main.cpp] +resharper_cpp_clang_tidy_clang_diagnostic_format_highlighting = none + +# --- the probes, the harness and the tests --- +[src/native/{tools,tests}/**.{cpp,h}] +# printf, fprintf, fputs, fclose: a probe prints what it found and a test prints why it failed; neither has anything +# to do about a failed write to its own console. +resharper_cpp_clang_tidy_cert_err33_c_highlighting = none +# atoi on the harness's own arguments, which its tests write: a number that does not parse is 0, and the run that +# asked for it fails on its own assertion. +resharper_cpp_clang_tidy_bugprone_unchecked_string_to_number_conversion_highlighting = none +# A printf-shaped helper (`Note(fmt, ...)`): the attribute clang proposes is not MSVC's, and a parameter pack would +# be a second implementation of printf. +resharper_cpp_clang_tidy_modernize_avoid_variadic_functions_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_missing_format_attribute_highlighting = none +# `&pointer` handed to an API that takes `void*` (ReadProcessMemory, a memcpy of a vtable slot, a Streamline array of +# constants): the conversion is the call's own. +resharper_cpp_clang_tidy_bugprone_multi_level_implicit_pointer_conversion_highlighting = none +# A test builds a handle or an address from a number, on purpose: a fake one, or one read from another process. +resharper_cpp_clang_tidy_performance_no_int_to_ptr_highlighting = none +# A macro that pastes its argument into a name (FL_DEV(vkGetDeviceQueue)) cannot put it in parentheses. +resharper_cpp_clang_tidy_bugprone_macro_parentheses_highlighting = none +# A test's fixture: a global with a std::string in it, a memcpy into a byte buffer that is not a string, two strings +# added in an assertion's message. +resharper_cpp_clang_tidy_bugprone_throwing_static_initialization_highlighting = none +resharper_cpp_clang_tidy_bugprone_not_null_terminated_result_highlighting = none +resharper_cpp_clang_tidy_performance_inefficient_string_concatenation_highlighting = none +# layout_test checks facts the compiler already knows - a constant's length, a bit-field's range - at run time, so +# that a failure prints which one: the branch that cannot be taken is the test passing. +resharper_cpp_unreachable_code_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unreachable_code_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_tautological_value_range_compare_highlighting = none + +# --- CODE LOADED INTO A GAME: the Overlay, the Vulkan layer, the shared-memory headers --- +# D100: here only a defect is fixed, in a pull request of its own with the hook's overhead measured (rule 5, +# 14_TESTING §Hook overhead). The report found none. What it did say about these files, each kept as it is: +[src/native/{FrameLedger.Overlay,FrameLedger.VkLayer,FrameLedger.Shm}/**.{cpp,h,inl}] +# Arms with the same body are different cases, each with its own comment saying why it reads as it does. +resharper_cpp_clang_tidy_bugprone_branch_clone_highlighting = none +# MinHook's MH_ALL_HOOKS is NULL, by its header. +resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none +# Kept on purpose, each with its reason beside it in dllmain.cpp: a retired enumerator whose bit must not be reused; +# slSetTag, deprecated by a header whose replacement no measured module exports. +resharper_cpp_enumerator_never_used_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_declarations_highlighting = none + +# DEAD CODE, FOUND AND NOT REMOVED: nothing calls dllmain.cpp's LogNoteW. D100 changes code loaded into a game for +# a defect only, so taking it out is the owner's to order (HANDOFF, the native report's section) and not this +# report's to do. Until then this one file is not read for an unused function. Remove this section with it. +[src/native/FrameLedger.Overlay/src/dllmain.cpp] +resharper_cpp_declarator_never_used_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unused_function_highlighting = none + +# The guard's rule matcher, which the Overlay compiles too. ResolveTolerance clears its out parameter with memset, as +# ResetRules does: a Tolerance is flags with default member initialisers, which is all "non-trivially default +# constructible" means here, and zero is what those initialisers say. +[src/native/FrameLedger.Injector/{src/fl_ac_rules.cpp,include/fl_ac_rules.h}] +resharper_cpp_clang_tidy_bugprone_raw_memory_call_on_non_trivial_type_highlighting = none diff --git a/.github/workflows/qodana.yml b/.github/workflows/qodana.yml index e69b4fcd..91c94f59 100644 --- a/.github/workflows/qodana.yml +++ b/.github/workflows/qodana.yml @@ -18,6 +18,12 @@ # contexts stay `check` and the two `analyze` jobs. A problem Qodana finds, a # Qodana Cloud outage or a lapsed licence is a red job beside a green `check`, # never a blocked merge. +# - Two jobs, two reports (D99): `managed` reads the solution - the C#, the XAML and +# what Rider's plugins read around it - and reports to the Qodana Cloud project +# `frameledger`; `native` reads the C++ of src/native through a Visual Studio +# solution CMake generates for it, with settings of its own (qodana-native.yaml), +# and reports to `frameledger-cpp`. Neither reads what the other does. The pull +# request's comment and annotations are the managed job's alone. # - `main` only: the `alpha` branch is main's source under another release line # (docs/13_CI_CD.md §The alpha line), and main's is what is analysed. @@ -107,3 +113,66 @@ jobs: env: QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} QODANA_ENDPOINT: 'https://qodana.cloud' + + native: + name: Qodana (native) + # The same condition as `managed`, for the same reason: QODANA_TOKEN_NATIVE + # reaches neither a fork's pull request nor Dependabot's. + if: >- + github.event_name != 'pull_request' || + (github.event.pull_request.head.repo.full_name == github.repository && + github.event.pull_request.user.login != 'dependabot[bot]') + runs-on: windows-latest + timeout-minutes: 60 + # No annotations and no comment from this job (below), so it writes nothing. + permissions: + contents: read + + steps: + - uses: actions/checkout@v7 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + # global.json sits above the solution, and the linter resolves it. + - name: Set up .NET + uses: actions/setup-dotnet@v6 + with: + global-json-file: global.json + + # The Visual Studio generator finds the toolset itself: no MSVC step. Configure + # fetches MinHook, Catch2 and jsmn into the build tree, as the gate's does. + - name: Generate the solution and the one generated header + shell: pwsh + working-directory: src/native + run: | + cmake --version + cmake --preset x64-vs-analysis + if ($LASTEXITCODE -ne 0) { throw 'cmake configure failed' } + cmake --build --preset x64-vs-analysis --target fl_ac_floor_gen + if ($LASTEXITCODE -ne 0) { throw 'generating the blocklist floor failed' } + if (-not (Test-Path ../../build/native/x64-vs-analysis/FrameLedgerNative.slnx)) { + Get-ChildItem ../../build/native/x64-vs-analysis -Filter 'FrameLedgerNative.*' | ForEach-Object { Write-Host $_.Name } + throw 'CMake did not write FrameLedgerNative.slnx (qodana-native.yaml names it)' + } + + # A report of its own: its own settings file, results folder, artifact, cache + # keys and Qodana Cloud project. The pull request's comment and annotations are + # the managed job's; a second job of the same linter would overwrite them. + - name: Qodana Scan + uses: JetBrains/qodana-action@3e8d76ff0e0241618abd808682f426afe84bab3f # v2026.2.2 + with: + args: --config qodana-native.yaml + results-dir: ${{ runner.temp }}/qodana-native/results + cache-dir: ${{ runner.temp }}/qodana-native/caches + pr-mode: false + upload-result: true + artifact-name: qodana-report-native + cache-default-branch-only: true + primary-cache-key: qodana-native-${{ github.ref_name }}-${{ github.sha }} + additional-cache-key: qodana-native-main + post-pr-comment: false + use-annotations: false + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_NATIVE }} + QODANA_ENDPOINT: 'https://qodana.cloud' diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d189f35..759093ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,18 @@ numeric core and does not move; the heading is the full version — corrected 20 ### Changed +- **Every place that starts a process was read, and the App now opens web and mail links only.** JetBrains' rule for + "a process started with something that is not a literal" reported 35 places — 11 in the product, 24 in tests. Each + was read: what it starts, and where the path and the arguments come from (the table in `docs/13_CI_CD.md` §Qodana). + None takes a value from outside the PC or from a file FrameLedger did not write, except the path and arguments of + the game the user added. One was hardened: `ShellUrlOpener` — what opens a link in the browser or the mail client — + now refuses any address that is not `http`, `https` or `mailto` itself, where it trusted each caller to have + checked; the shell runs whatever it is handed, and a `file:` address is a program. Every caller already passed one + of the project's own pages or a link held to those schemes, so no link you could click before stops working. The + rule stays on: the files its results were read in are listed in `qodana.yaml`, so a new file that starts a + process is reported — by path on the plugin's one inspection, since a rule's own id is honoured nowhere (three + runs measured it). And a test of the repository's own, `ProcessStartSitesTests`, in the gate, fails on a new file + that starts a process, or registers a scheduled task, until it has been read and listed. - **Qodana for .NET, on the Ultimate licence, reads the managed code** (developers only; owner decisions D99 and D100). The owner took an Ultimate licence for the Qodana Cloud organisation and asked for Qodana over every language. The job — `managed`, *Qodana (managed)* in a pull request's checks — now runs Qodana for .NET (Rider's engine) in native @@ -52,18 +64,20 @@ numeric core and does not move; the heading is the full version — corrected 20 engine that raised it reads** — one of ReSharper's in `.editorconfig`, what has no key there in `qodana.yaml` — which amends D93's "never in `qodana.yaml`" (`docs/13_CI_CD.md` §Qodana). The C++ goes to a second report, the next pull request's. -- **Every place that starts a process was read, and the App now opens web and mail links only.** JetBrains' rule for - "a process started with something that is not a literal" reported 35 places — 11 in the product, 24 in tests. Each - was read: what it starts, and where the path and the arguments come from (the table in `docs/13_CI_CD.md` §Qodana). - None takes a value from outside the PC or from a file FrameLedger did not write, except the path and arguments of - the game the user added. One was hardened: `ShellUrlOpener` — what opens a link in the browser or the mail client — - now refuses any address that is not `http`, `https` or `mailto` itself, where it trusted each caller to have - checked; the shell runs whatever it is handed, and a `file:` address is a program. Every caller already passed one - of the project's own pages or a link held to those schemes, so no link you could click before stops working. The - rule stays on: the files its results were read in are listed in `qodana.yaml`, so a new file that starts a - process is reported — by path on the plugin's one inspection, since a rule's own id is honoured nowhere (three - runs measured it). And a test of the repository's own, `ProcessStartSitesTests`, in the gate, fails on a new file - that starts a process, or registers a scheduled task, until it has been read and listed. +- **Qodana reads the C++ too, as a second report** (developers only; owner decision D99). The job `native` has CMake + write a Visual Studio solution for `src/native` (the preset `x64-vs-analysis`; nothing ships from it) and runs + Qodana for .NET over it — ReSharper's C++ inspections and the clang-tidy checks they bundle — with settings of its + own (`qodana-native.yaml`), reporting to a Qodana Cloud project of its own. Its first run reported 4,695 problems, + 4,040 of them hints; of the 655 left, 494 are distinct (a file compiled into three targets is reported three + times). Nearly all of them are not faults, and `.editorconfig` now says why in fifty-four lines, each with its + reason: clang's opinion of code that only MSVC builds (`__try`, a function pointer got by name, struct padding); + the engine misreading `std::atomic_ref`, zero-initialised API structures and tests of `constexpr` functions; + proposals to restate working code in a newer idiom; and what a probe or a test does on purpose. Eleven things + were fixed, none changing what a shipped binary does: `std::size` for four hand-written array lengths, two + multiplications done in a narrower type than their result, two unused member functions, an unused type alias, two + unused includes. **In code loaded into a game nothing was changed**: the report found no defect there, and what it + did say about those files is listed in `docs/13_CI_CD.md` §Qodana — among it one function in the Overlay that + nothing calls (`LogNoteW`), which is recorded for the owner and not removed (D100). The gate is zero problems and the job is advisory, like the other. ### Fixed diff --git a/CLAUDE.md b/CLAUDE.md index acd4a4ee..eaaa1150 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -73,6 +73,8 @@ RELEASE_LINE # `main`, or `alpha` on the alpha branch (D73, 20 build.ps1 # the quality gate; CI runs this identical script SonarQube.Analysis.xml # SonarCloud's settings for ci.yml's sonarcloud job (D68, 2026-10-25; it replaced .config/dotnet-tools.json # .sonarcloud.properties) and the scanner it runs — 13_CI_CD §SonarCloud +qodana-native.yaml # the same for the native job: the C++ of src/native, through the Visual Studio solution + # CMake writes for it (preset x64-vs-analysis), a report of its own (D99) qodana.yaml # Qodana's settings for the managed job of .github/workflows/qodana.yml (D93; Qodana for # .NET on the Ultimate licence since 2026-11-11, D99): the linter, the solution, a gate # of zero problems, and what is switched off that .editorconfig has no key for — @@ -181,7 +183,7 @@ Dependency direction: `App/Agent → Application → Domain`; **`Application → **C# —** `Nullable enable`, `TreatWarningsAsErrors`, `AnalysisLevel latest-all`, file-scoped namespaces, Roslynator + Meziantou + VS Threading analyzers, `dotnet format` clean. Qodana reads the C# and the XAML in an advisory workflow of its own, with a gate of zero problems *(since 2026-11-10, D93; Qodana for .NET on the Ultimate licence since 2026-11-11, D99 — `13_CI_CD` §Qodana)*: fix what it reports, or switch the inspection off with the reason on the line above, **in the place the engine that raised it reads** *(D100)* — one of ReSharper's (C#, XAML, `.resx`, the C++) in `.editorconfig`; what has no key there (the hints as a severity, the Markdown and XML inspections, the files JetBrains' security rules were read in) in `qodana.yaml` — never anywhere else, never without a reason. A new file that starts a process fails `ProcessStartSitesTests`, and Qodana's security rule reports it: read what it starts and where the path and the arguments come from, then list it in the test, in `qodana.yaml` and in `13_CI_CD` §Qodana. Async suffixed `Async`, `ConfigureAwait(false)` off the UI. All user-visible strings from `.resx`. Timestamps UTC (unix-ms in SQLite); QPC ticks only inside the capture pipeline. -**C++ —** `clang-format` (LLVM base, 4-space, 120 col) enforced in CI. No STL containers that allocate in hook paths. No `std::mutex` in hook paths. `-D_HAS_EXCEPTIONS=0` in the Overlay target. Every hook entry point wrapped per the `FL_HOOK_GUARD` macro (`17_HOOK_ENGINE`). Static analysis: ~~`/analyze` + clang-tidy (`bugprone-*`, `cert-*`, `concurrency-*`)~~ CodeQL (`codeql.yml`, a required check); `/analyze` and clang-tidy are not configured *(corrected 2026-10-04)*. SonarCloud analyses the C++ too, from CMake's compilation database, in `ci.yml`'s advisory `sonarcloud` job *(since 2026-10-25, D68 — `13_CI_CD` §SonarCloud)*. +**C++ —** `clang-format` (LLVM base, 4-space, 120 col) enforced in CI. No STL containers that allocate in hook paths. No `std::mutex` in hook paths. `-D_HAS_EXCEPTIONS=0` in the Overlay target. Every hook entry point wrapped per the `FL_HOOK_GUARD` macro (`17_HOOK_ENGINE`). Static analysis: ~~`/analyze` + clang-tidy (`bugprone-*`, `cert-*`, `concurrency-*`)~~ CodeQL (`codeql.yml`, a required check); `/analyze` and clang-tidy are not configured *(corrected 2026-10-04)*. SonarCloud analyses the C++ too, from CMake's compilation database, in `ci.yml`'s advisory `sonarcloud` job *(since 2026-10-25, D68 — `13_CI_CD` §SonarCloud)*. Qodana reads it as well, in a report of its own *(since 2026-11-11, D99: ReSharper's C++ inspections and the clang-tidy checks they run, advisory, a gate of zero — `13_CI_CD` §Qodana)*: fix what it reports, or switch the inspection off in `.editorconfig` with the reason above it; **in code loaded into a game only a defect is fixed**, in a pull request of its own with the overhead measured *(D100)*. **Licence header —** every first-party source file (`.cs .cpp .h .inl .ps1 .xaml`) opens with two comment lines, `SPDX-License-Identifier: GPL-3.0-only` and `Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE` (beta.12, owner decision D45). GPLv3 §7 requires additional terms to be named in the source files, and `NOTICE` holds them — (b) preserve the notices, (c) mark modified versions, (e) no trademark rights in the name. `tools/notice-check.ps1` is a `build.ps1` gate; `-Fix` writes a missing header. `src/native/third_party/` is excluded. diff --git a/docs/12_BUILD.md b/docs/12_BUILD.md index 73004fce..defaf329 100644 --- a/docs/12_BUILD.md +++ b/docs/12_BUILD.md @@ -20,6 +20,11 @@ cmake --preset x64-release cmake --build --preset x64-release ``` +A third preset, **`x64-vs-analysis`** *(2026-11-11)*, builds nothing that ships: it has CMake write a Visual Studio +solution (`build/native/x64-vs-analysis/FrameLedgerNative.slnx`, generator "Visual Studio 18 2026", tests and tools +on) for Qodana's native report, which reads C++ through a solution (`13_CI_CD` §Qodana). It needs Visual Studio 18; +the gate and the release never use it. + Targets: - `FrameLedger.Overlay` → `FrameLedger.Overlay.dll` - `FrameLedger.VkLayer` → `FrameLedger.VkLayer.dll` + `VkLayer_FRAMELEDGER_overlay.json` diff --git a/docs/13_CI_CD.md b/docs/13_CI_CD.md index e8349e50..8da92ed0 100644 --- a/docs/13_CI_CD.md +++ b/docs/13_CI_CD.md @@ -126,7 +126,9 @@ FrameLedger uses the **`poli0981/.github` ops repo** where its templates fit, an ### `qodana.yml` — push to `main`, pull requests into `main`, `workflow_dispatch` · **repo-local, built 2026-11-10 (D93); Qodana for .NET since 2026-11-11 (D99)** - ~~One job, `qodana`, on `ubuntu-latest` — the only Linux job in this repository, because the linter is a Linux - container~~ The job `managed` (*Qodana (managed)*), on `windows-latest`: `JetBrains/qodana-action` (pinned to + container~~ Two jobs, on `windows-latest`, each a report of its own: **`native`** (*Qodana (native)*) has CMake + write a Visual Studio solution and reads the C++ of `src/native` with `qodana-native.yaml`'s settings; and + `managed` (*Qodana (managed)*): `JetBrains/qodana-action` (pinned to `v2026.2.2`'s commit; Dependabot moves the pin) runs **Qodana for .NET** in native mode over `FrameLedger.slnx` with `qodana.yaml`'s settings, after a `dotnet build`. No job here runs on Linux any more. §Qodana below says what it reads, what was changed from JetBrains' template and where an inspection is switched off. @@ -505,7 +507,7 @@ is; below that is D93's own account, which is now history. **Two reports (D99).** Asked how to gather the C# and the C++, the owner chose two reports from the start, and made a second Qodana Cloud project (`frameledger-cpp`, the `QODANA_TOKEN_NATIVE` secret). The managed report leaves -`src/native` out; the native one — the next pull request's — reads nothing else, so every file is in exactly one. +`src/native` out; the native one (*The native report*, below) reads nothing else, so every file is in exactly one. **What is read, and by what.** @@ -514,9 +516,9 @@ second Qodana Cloud project (`frameledger-cpp`, the `QODANA_TOKEN_NATIVE` secret | The C#, XAML and `.resx` of the thirteen projects | `managed` | ReSharper's engine, as under D93 | | Markdown and XML around the solution | `managed` | the IntelliJ platform's own inspections — 23 and 10 results on the first run | | JetBrains' security rules over the C# — pattern rules for a process start, an SQL text and the like | `managed` | new with this linter (its OpenGrep plugin) — 36 results on the first run, every one read; the files they were read in are listed in `qodana.yaml`, so a new one is reported | -| The C++ of `src/native` | the `native` job | the pull request after this one | +| The C++ of `src/native` | `native` | ReSharper's C++ engine and the clang-tidy checks it bundles, over a Visual Studio solution CMake writes for it | | JSON and YAML, the workflows among them | nothing reported | whether the profile inspects them and found nothing, or does not inspect them, was not established; CodeQL's `actions` language reads the workflows | -| PowerShell (`build.ps1`, `tools/`) and CMake files | no linter of JetBrains' reads them here | SonarCloud reads the PowerShell | +| PowerShell (`build.ps1`, `tools/`), CMake files, the HLSL shader | no linter of JetBrains' reads them here | SonarCloud reads the PowerShell | **The first runs on this linter, and what was done (2026-11-11).** Run 42923079119 — the job with no settings beyond the solution: **3,953 problems** in 92 inspections, and 3,607 of them **hints**: the lowest level an IDE has, which the @@ -580,13 +582,75 @@ arguments come from. None takes a value from outside the PC or from a file FrameLedger did not write, except the game's own path and arguments — which starting the game the user chose is. +**The native report — `qodana-native.yaml`, the job `native` (D99, 2026-11-11).** The C++ of `src/native`, read by +the same linter — Qodana for .NET, whose C++ is ReSharper C++ — in native mode on a Windows runner. It is the only +linter of JetBrains' that can: the native layer is MSVC-only, and the two C/C++ linters (`qodana-cpp`, +`qodana-clang`) are Linux images. It reads C++ through a Visual Studio solution, and `src/native` is a CMake tree, so +the job has CMake write one first: the preset **`x64-vs-analysis`** (generator "Visual Studio 18 2026", tests and +tools on) puts `FrameLedgerNative.slnx` under `build/native/x64-vs-analysis`, and the job builds from it the one +target whose output is a header (`fl_ac_floor_gen`, the blocklist floor). Nothing else is compiled, and nothing from +that tree ships. Then the action, with `--config qodana-native.yaml`: the solution, `RelWithDebInfo` and `x64` — the +flags the shipped binaries are built with — and, left out by path, what is not FrameLedger's code (the build tree, +`third_party`, the vendor stubs, a compiled shader as a byte array). Its own results folder, cache keys and artifact +(`qodana-report-native`), and the Qodana Cloud project `frameledger-cpp` through `QODANA_TOKEN_NATIVE`. It posts no +comment and no annotations — a second job of the same linter would overwrite the managed job's — so its result is the +job's own status and its report. Advisory, and a gate of zero, like the other. + +**What it runs** is ReSharper's C++ inspections and, through them, the clang-tidy checks and clang diagnostics that +engine bundles. clang never builds this code — MSVC does, with `/W4 /WX` — so what clang says is read as advice. Every +one of them has a key in `.editorconfig` (`resharper_cpp_…_highlighting`; a clang-tidy check's is +`resharper_cpp_clang_tidy__highlighting`), so D100's rule holds without a second file: no `.clang-tidy`. + +**Its first runs, and what was done.** Run 42923079119: **4,695 problems**, 4,040 of them hints, which are off as on +the managed side. Run 42928814104: **655** — **494 distinct**, because a source file compiled into three targets is +reported three times. + +| What | distinct | Done | +|---|---|---| +| A choice this code made, off for the native tree: where the compiler pads a struct (46); MSVC's own keywords, `__try` among them (54); a function pointer got by name cast to its real type, through `void*` (55); `reinterpret_cast` where memory is read as something else (5); `std::cmp_less` proposed for comparisons that already cast (20); a `default:` under a full enum switch (3); a copied verdict (4); the moves of a type that owns a handle (11); a zeroed out-parameter enum (8); an enum's width (5); "can be made const / constexpr / static" (52); "possibly unused `#include`" (15) | 278 | off in `.editorconfig`, each with its reason. Of the fifteen includes two were unused and were removed; the others are a file including what it uses although another header already brings it | +| A newer idiom proposed for working code — a range-for, `std::ranges`, `any_of`, `starts_with`, a raw string, an `if` with an initialiser | 53 | off: the native code is written to be read beside the hook path, an index and a plain loop | +| **The engine misreading**: `std::atomic_ref::fetch_or` as an expression without side effects (7); a Win32, D3D12 or ffx-api structure zero-initialised and then filled field by field as "always rewritten" and "assigned, never used" (15); a test of a `constexpr` function as a redundant argument (3) | 25 | off, with what the engine gets wrong written beside the keys | +| Fields nothing names, in a structure Windows defines and the SDK's headers do not give (`RTL_PROCESS_MODULE_INFORMATION`, `PROCESS_MEMORY_COUNTERS_EX2`) and in a test's stand-in for a Vulkan object | 25 | off for those four files: the fields are what puts the others at their offsets | +| `%lu` with an `NvU32`, in `fl-probe-nvapi` | 19 | off for that file: NVAPI's header makes `NvU32` an `unsigned int` under clang and an `unsigned long` under MSVC — the linter's compiler, not the build's | +| The probes, the harness and the tests: an unchecked `printf` (35), `atoi` on the harness's own arguments (20), a `&pointer` handed to a `void*` parameter (7), a printf-shaped helper (4), a fake handle built from a number (4), a test's fixtures (4), `layout_test`'s run-time checks of compile-time facts (3), a macro that pastes a name (1) | 78 | off for `tools` and `tests` | +| Code loaded into a game (below) | 7 | kept as it is, off for those files; one of them is dead code, recorded for the owner | +| **Fixed**: `sizeof(a) / sizeof(a[0])` → `std::size(a)` (4); a multiplication done in a narrower type than the one it is stored in or compared with (2: a constant in the guard's sources, a test); a member function, and a type alias, nothing used (3) | 9 | in the code; none changes what a shipped binary does | + +With those settled, run 42942068024 — the first with these settings — reported **one** problem: `LogNoteW`, now by +ReSharper's own inspection where clang's had said it before (below). And run 42943094415 (2026-11-11, this pull +request's branch): **no problem reported** — the gate's zero, in the native report too. + +**Code loaded into a game — the Overlay, the Vulkan layer, the shared-memory headers, the guard's rule matcher.** +D100: there only a defect is fixed, in a pull request of its own with the hook's overhead measured (rule 5, +`14_TESTING` §Hook overhead), and a proposal about style is not acted on. About a quarter of the 655 results were in +those files; nearly all of them are the tree-wide kinds above. **The report found no defect there.** What is +particular to them, read and kept: two `if` chains whose arms have the same body and are different cases, each with +its comment (`dllmain.cpp`); MinHook's `MH_ALL_HOOKS`, which is `NULL` by its header; a retired enumerator kept so +that its bit is not reused; `slSetTag`, deprecated by a header whose replacement no measured module exports; +`ResolveTolerance` clearing its out-parameter with `memset`, as `ResetRules` does — a `Tolerance` is flags whose +default initialisers are zero. And one thing that is not as it should be: **`LogNoteW` in `dllmain.cpp`, which nothing +calls** — dead code. It is not a defect, so D100 leaves its removal to the owner (HANDOFF); until then that one file +is not read for an unused function (`.editorconfig` says so, in a section to be removed with it). + +**"Zero" has to mean "analysed".** A report with no problem cannot tell a clean tree from one the linter did not +read. So the settings were proved on a branch that puts back three of the things fixed here — the unused alias, the +unused member function, the narrow multiplication. Run 42942390715 reported exactly those three, each by the +inspection that had found it the first time (`CppTypeAliasNeverUsed` in `tools/fl-probe-interposer/main.cpp`; +`clang-diagnostic-unused-member-function` and `bugprone-implicit-widening-of-multiplication-result` in +`tests/ring_test.cpp`), and `LogNoteW`, and nothing else. The branch was deleted. Do the same before trusting a +zero after a change to the preset, the settings or the linter's version. + +**What it does not read.** CMake files and PowerShell have no inspection in this linter (SonarCloud reads the +PowerShell); the HLSL shader and the `.def` file are not C++. CodeQL (`analyze (cpp, manual)`, a required check) and +SonarCloud go on reading the C++ as before: this is a third reader, and the only one of the three that is ReSharper's. + **Where an inspection is switched off: by the engine that raised it (D100, amending D93's "never in `qodana.yaml`").** What Qodana reports is fixed, unless the inspection argues with a choice this project made; then it is off, with the reason on the line above — in the place the engine that raised it reads: -- **ReSharper's** — the C#, the XAML, the `.resx`, and the C++ of the native report — in **`.editorconfig`** - (`resharper_*_highlighting`), where Rider and ReSharper in the editor read it too. Sixty-four keys since this pull - request. +- **ReSharper's** — the C#, the XAML, the `.resx`, and the C++ of the native report with the clang-tidy checks it + runs — in **`.editorconfig`** (`resharper_*_highlighting`), where Rider and ReSharper in the editor read it too: + sixty-four keys for the managed code, fifty-four lines for the C++, some of them for a folder or a file alone. - **What has no key there** — in **`qodana.yaml`**: a whole severity (the hints) and the IntelliJ platform's Markdown and XML inspections under `profile.inspections`; under `exclude`, by inspection and path, the files JetBrains' security rules were read in and a file the linter itself fails on. diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index 8f8b0520..72058287 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -244,9 +244,46 @@ runner) and settles what it reports over the managed code; the next adds the C++ - **A Qodana run of the managed job takes fifteen to seventeen minutes**, most of it the scan; a pull request's own run reads the whole solution (`pr-mode: false`), so there is no quick partial run to iterate on. -**Next:** the native report — a Visual Studio solution generated by CMake (`x64-vs-analysis`), `qodana-native.yaml`, -the job `native`; 655 results on its first run with the hints off, 494 of them distinct (a file compiled into three -targets is reported three times), about a quarter in code loaded into a game. +**Then:** the native report, in the pull request after it — the next section. + + +### Qodana — the native report: the C++ through a solution CMake writes (D99, D100) + +*Status is `docs/13_CI_CD.md` §Qodana and `CHANGELOG.md`; this is what no other file carries.* The second pull request +of the third part: the job `native`, `qodana-native.yaml`, the preset `x64-vs-analysis`, fifty-four `.editorconfig` +lines for the C++ and eleven small fixes outside code loaded into a game. + +**Choices made here:** + +- **One linter for both reports.** Qodana for .NET is the only linter of JetBrains' that reads this C++ (MSVC-only; + `qodana-cpp` and `qodana-clang` are Linux images), and it wants a Visual Studio solution — so CMake writes one. The + generated solution is never built from, beyond the one header a build generates. +- **No `.clang-tidy` file.** The plan had expected one. Every clang-tidy check and clang diagnostic the engine runs + has an `.editorconfig` key of ReSharper's, so D100's "where the engine reads" is one file for all of the C++, and + the repository gains no clang-tidy configuration that a developer's editor would start obeying. +- **Most of what it reported is not a fault, and the settings say why, line by line**: clang's opinion of code only + MSVC builds; the engine misreading `atomic_ref`, zero-initialised API structures and constexpr tests; proposals of + a newer idiom. Eleven things were fixed. **In code loaded into a game nothing was changed**: no defect was found + there. +- **`LogNoteW` (`FrameLedger.Overlay/src/dllmain.cpp`) is dead code, and it is still there — the owner's call.** + Nothing calls it. D100 changes code loaded into a game for a defect only, and an unused function is not one, so + it was not removed on a linter's word; `.editorconfig` leaves that one file unread for an unused function, in a + section that says to remove it with the function. Removing it is eleven lines with no caller: a pull request of + its own, whose overhead statement is that the function was never reached. +- **"Possibly unused `#include`" is off, not obeyed.** Ten of the twelve reported outside the game are a file + including what it uses (`` for `std::memset`) although `` already brought it; removing them + would have made the files depend on an accident. + +**Traps:** + +- **InspectCode cannot load the native solution on the owner's PC** (Visual Studio 18 Insiders' MSBuild crashes it, + 2026.2.3.1 and 2026.3.0 alike), so C++ results are read from CI: dispatch `qodana.yml` on the branch, download + `qodana-report-native`, unzip the inner `qodana-report.zip`. +- **A file compiled into three targets is reported three times**: count distinct results (rule, file, line), not rows. +- **A shortened line is a clang-format change two lines away**: the gate's clang-format step failed on an alignment + that the edit above it had made possible. Run clang-format on every native file touched before the gate. +- **Do not switch branches while a gate runs** — a probe branch was made during a local native build, which changed + and restored two sources under it. Nothing came of it; the next gate was run on a still tree. ## Owner-only — no PR can close these diff --git a/qodana-native.yaml b/qodana-native.yaml new file mode 100644 index 00000000..2ac55db3 --- /dev/null +++ b/qodana-native.yaml @@ -0,0 +1,45 @@ +# Qodana's settings for the `native` job of .github/workflows/qodana.yml (owner decision D99, 2026-11-11; +# docs/13_CI_CD.md §Qodana). +# +# The C++ of src/native, read by Qodana for .NET (qodana-dotnet: Rider's engine, whose C++ is ReSharper C++) in native +# mode on a Windows runner. That linter is the only one that can: the native layer is MSVC-only, and JetBrains' two +# C/C++ linters (qodana-cpp, qodana-clang) are Linux images. It reads C++ through a Visual Studio solution, and +# src/native is a CMake tree, so the job generates one first - the `x64-vs-analysis` preset - and builds from it only +# the one header a build generates (the blocklist floor). Nothing else is compiled. +# +# A report of its own, in a Qodana Cloud project of its own (`frameledger-cpp`, the QODANA_TOKEN_NATIVE secret): the +# managed report (qodana.yaml) leaves src/native out, so every file is in exactly one of the two. +version: "1.0" +linter: qodana-dotnet +withinDocker: false + +profile: + base: + name: qodana.recommended + groups: + - groupId: Hints + groups: + - "severity:TYPO" + inspections: + - group: Hints + enabled: false + +dotnet: + solution: build/native/x64-vs-analysis/FrameLedgerNative.slnx + # The flags the shipped binaries are built with (the x64-release preset's build type). + configuration: RelWithDebInfo + platform: x64 + +# What is not FrameLedger's code: what CMake generates and fetches (MinHook, Catch2, jsmn, the floor header), the +# vendored SDK headers, the fixtures that carry the vendors' names on purpose, a compiled shader as a byte array. +exclude: + - name: All + paths: + - build + - src/native/third_party + - src/native/tools/vendor-stubs + - src/native/tools/hook-harness/dxr_raygen_dxil.h + +failureConditions: + severityThresholds: + any: 0 diff --git a/src/native/CMakePresets.json b/src/native/CMakePresets.json index 78b2143b..f24c7c11 100644 --- a/src/native/CMakePresets.json +++ b/src/native/CMakePresets.json @@ -25,11 +25,24 @@ "inherits": "x64-base", "displayName": "x64 Release", "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } + }, + { + "name": "x64-vs-analysis", + "displayName": "x64, a Visual Studio solution for Qodana's native report (nothing is built from it but one generated header)", + "generator": "Visual Studio 18 2026", + "binaryDir": "${sourceDir}/../../build/native/${presetName}", + "architecture": { "value": "x64", "strategy": "set" }, + "cacheVariables": { + "FL_BUILD_TESTS": "ON", + "FL_BUILD_TOOLS": "ON", + "CMAKE_CXX_SCAN_FOR_MODULES": "OFF" + } } ], "buildPresets": [ { "name": "x64-debug", "configurePreset": "x64-debug" }, - { "name": "x64-release", "configurePreset": "x64-release" } + { "name": "x64-release", "configurePreset": "x64-release" }, + { "name": "x64-vs-analysis", "configurePreset": "x64-vs-analysis", "configuration": "RelWithDebInfo" } ], "testPresets": [ { diff --git a/src/native/FrameLedger.Injector/src/fl_guard_sources.cpp b/src/native/FrameLedger.Injector/src/fl_guard_sources.cpp index ed38d964..1688cf4b 100644 --- a/src/native/FrameLedger.Injector/src/fl_guard_sources.cpp +++ b/src/native/FrameLedger.Injector/src/fl_guard_sources.cpp @@ -574,7 +574,7 @@ Collected EnumerateDirEntriesImpl(const wchar_t* dir, DirEntrySink sink, void* c // Bounds, all REFUSALS rather than truncations, like check 4's: a Steam library whose manifests we could not all read // is a library whose answer we do not know. constexpr std::size_t kMaxSteamManifests = 4096; -constexpr std::size_t kMaxManifestBytes = 256 * 1024; +constexpr std::size_t kMaxManifestBytes = std::size_t{256} * 1024; // The quoted value that follows `"key"` in Valve's KeyValues text, ASCII case-insensitive on the key, with the // format's two escapes (\" and \\) undone. False when the key is absent or its value does not fit. diff --git a/src/native/tests/nvapi_bridge_test.cpp b/src/native/tests/nvapi_bridge_test.cpp index b7c552ed..8eca96ac 100644 --- a/src/native/tests/nvapi_bridge_test.cpp +++ b/src/native/tests/nvapi_bridge_test.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "fl_nvapi_bridge.h" @@ -47,10 +48,10 @@ TEST_CASE("a wrong struct size is refused before anything is read", "[nvapi][abi TEST_CASE("a path longer than NVAPI's string is refused, never truncated into another program's", "[nvapi][abi]") { static uint16_t long_path[4096]; - for (size_t i = 0; i + 1u < sizeof(long_path) / sizeof(long_path[0]); ++i) { + for (size_t i = 0; i + 1u < std::size(long_path); ++i) { long_path[i] = u'a'; } - long_path[sizeof(long_path) / sizeof(long_path[0]) - 1u] = 0u; + long_path[std::size(long_path) - 1u] = 0u; FlNvDriverProfileRead p{}; p.size = sizeof(FlNvDriverProfileRead); CHECK(FlNvDriverProfile(long_path, nullptr, 0u, &p) == FL_NV_BAD_ARGUMENT); diff --git a/src/native/tests/ring_test.cpp b/src/native/tests/ring_test.cpp index 0ec3f104..1d093a11 100644 --- a/src/native/tests/ring_test.cpp +++ b/src/native/tests/ring_test.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -54,7 +53,6 @@ struct Mapping { explicit Mapping(std::uint32_t capacity) : bytes(FlShmSizeForCapacity(capacity), 0) {} void* base() { return bytes.data(); } - const void* base() const { return bytes.data(); } FlFrameRecord* slot(std::uint32_t i) { return reinterpret_cast(bytes.data() + FL_SHM_RING_OFFSET) + i; } @@ -163,7 +161,7 @@ TEST_CASE("seq is monotonic per slot and never reset across laps", "[ring]") { } // Slot 0 was written three times: 2, 4, 6. CHECK(m.slot(0)->seq == 6u); - CHECK(m.writer()->writeIndex == kCap * 3); + CHECK(m.writer()->writeIndex == std::uint64_t{kCap} * 3); } TEST_CASE("a torn record is reported as a GAP, not silently skipped", "[ring]") { diff --git a/src/native/tools/fl-probe-interposer/main.cpp b/src/native/tools/fl-probe-interposer/main.cpp index 1adf8875..51f8554f 100644 --- a/src/native/tools/fl-probe-interposer/main.cpp +++ b/src/native/tools/fl-probe-interposer/main.cpp @@ -269,7 +269,6 @@ bool RunControl(Gfx& g) { using PFN_slInit = ::PFun_slInit*; using PFN_slSetD3DDevice = ::PFun_slSetD3DDevice*; using PFN_slIsFeatureLoaded = ::PFun_slIsFeatureLoaded*; -using PFN_slShutdown = ::PFun_slShutdown*; using PFN_D3D12CreateDevice = HRESULT(WINAPI*)(IUnknown*, D3D_FEATURE_LEVEL, REFIID, void**); struct Gfx12 { diff --git a/src/native/tools/fl-probe-signer/main.cpp b/src/native/tools/fl-probe-signer/main.cpp index 8b9d6d97..6b718efb 100644 --- a/src/native/tools/fl-probe-signer/main.cpp +++ b/src/native/tools/fl-probe-signer/main.cpp @@ -71,7 +71,6 @@ #include #include -#include #include #include #include @@ -342,8 +341,6 @@ struct NetCensus { bool winhttp = false; bool wininet = false; bool dnsapi = false; - - bool Any() const { return cryptnet || winhttp || wininet || dnsapi; } }; NetCensus TakeCensus() { diff --git a/src/native/tools/hook-harness/main.cpp b/src/native/tools/hook-harness/main.cpp index e4250ece..9f97d927 100644 --- a/src/native/tools/hook-harness/main.cpp +++ b/src/native/tools/hook-harness/main.cpp @@ -127,6 +127,7 @@ #include #include #include +#include #include #include "dxr_raygen_dxil.h" @@ -3065,7 +3066,7 @@ int main(int argc, char** argv) { LateLoad& l = g_lateLoads[g_lateLoadCount]; l.delayMs = static_cast(std::atoi(argv[++i])); const char* path = argv[++i]; - MultiByteToWideChar(CP_ACP, 0, path, -1, l.path, static_cast(sizeof(l.path) / sizeof(l.path[0]))); + MultiByteToWideChar(CP_ACP, 0, path, -1, l.path, static_cast(std::size(l.path))); HANDLE t = CreateThread(nullptr, 0, &LateLoadThread, &l, 0, nullptr); if (t != nullptr) { CloseHandle(t); @@ -3080,9 +3081,8 @@ int main(int argc, char** argv) { // stays loaded for the life of the process so the scan sees it. const char* path = argv[++i]; wchar_t wide[MAX_PATH * 2]{}; - const int n = - MultiByteToWideChar(CP_ACP, 0, path, -1, wide, static_cast(sizeof(wide) / sizeof(wide[0]))); - HMODULE h = n > 0 ? LoadLibraryW(wide) : nullptr; + const int n = MultiByteToWideChar(CP_ACP, 0, path, -1, wide, static_cast(std::size(wide))); + HMODULE h = n > 0 ? LoadLibraryW(wide) : nullptr; std::printf(" --load %s -> %s\n", path, h != nullptr ? "loaded" : "FAILED"); if (h == nullptr) { return 3; diff --git a/wiki/Releasing.md b/wiki/Releasing.md index 695725e3..b6c4182d 100644 --- a/wiki/Releasing.md +++ b/wiki/Releasing.md @@ -8,7 +8,7 @@ The full documents are [`docs/13_CI_CD.md`](../docs/13_CI_CD.md) and [`docs/11_U |---|---|---| | `.github/workflows/ci.yml` | pushes to `main` and `alpha`, pull requests | `./build.ps1 check`, and on a pull request the changelog check; then, in a job of its own, the SonarCloud analysis with the gate's coverage (settings: `SonarQube.Analysis.xml`). | | `.github/workflows/codeql.yml` | pushes and pull requests to `main`, weekly | CodeQL for C#, C++ and the workflows themselves. | -| `.github/workflows/qodana.yml` | pushes and pull requests to `main`; by hand | Qodana for .NET (Rider's engine, on the Ultimate licence) over the C# and the XAML, the Markdown and XML around them, and JetBrains' security rules over the C#; fails on any problem, and blocks nothing (settings: `qodana.yaml`, and `.editorconfig` for the inspections). | +| `.github/workflows/qodana.yml` | pushes and pull requests to `main`; by hand | Qodana for .NET (Rider's engine, on the Ultimate licence) over the C# and the XAML, the Markdown and XML around them, and JetBrains' security rules over the C#; and, as a second report, the C++ of `src/native`; each fails on any problem, and blocks nothing (settings: `qodana.yaml`, and `.editorconfig` for the inspections). | | `.github/workflows/rules-publish.yml` | a change to the detection rules or their validator | Fails when an anti-cheat entry is removed. | | `.github/workflows/release.yml` | a pushed `v*` tag; by hand, a rehearsal | Builds, gates and publishes a release. | | `.github/workflows/wiki.yml` | a successful release; by hand | Builds this wiki from `wiki/` and `guide/` and publishes it to the Wiki tab. |