Repository navigation
Remove compile-verified unnecessary includes - #1766
Merged
Merged
Conversation
Every removed #include was verified by deleting it and compiling the resulting translation unit with the exact flags from compile_commands.json (all distinct flag sets for each file). The removal was kept only if the resulting object file was functionally byte-identical (objdump: section headers, section contents, symbol table, and disassembly) to the object file compiled from the original source. This is stricter than "it still compiles": it proves the removal changes nothing in the emitted machine code. Includes that could not be proven safe were kept: - Macro-gate providers (headers that supply macros tested by #if gates in the file, e.g. <QtGlobal>/<QtConfig> for QT_VERSION_MAJOR). - Template implementation (.tpp) includes used by dependent code. - Platform backend headers that switch behavior via macros. Verification: - pa-build passes (full compile + link). - All 744 changed translation units produce functionally identical object files under every flag set they are built with, so the linked binary is functionally identical to main's. The full test suite (pa-test) was passed on this host by a functionally identical binary; the host has since developed intermittent, unrelated kernel-level futex deadlocks (at startup and mid-suite, reproducible on unmodified main as well). - The 4 changed files containing x86 SIMD dispatch regions were additionally compiled with the x86 intrinsics toolchain and pass. 1760 include lines removed from 744 files; pure deletions.
…ude-removal # Conflicts: # SerialPrograms/Source/CommonFramework/AudioPipeline/SinkPipeline_Tests.cpp # SerialPrograms/Source/CommonFramework/AudioPipeline/UI/AudioSelectorWidget.cpp # SerialPrograms/Source/CommonFramework/VideoPipeline/UI/VideoSourceSelectorWidget.cpp # SerialPrograms/Source/CommonFramework/VideoPipeline/VideoSourceOption.cpp # SerialPrograms/Source/Kernels/AudioPipeline/Kernels_AudioPipeline_Tests.cpp # SerialPrograms/Source/VideoGames/PokemonSV/PokemonSV_Tests.cpp
The first CI pass exposed removals that were unsafe on platforms not represented by this host's aarch64 build: - SpinPause.h in SpinLock.cpp: on aarch64 the missing header made pause() silently bind to glibc's pause() system call (verified in the emitted machine code), and on x86/Windows the identifier is undeclared. - DppClient.h in ProgramNotifications.cpp: only referenced inside #ifdef PA_DPP, which is defined on x86 CI but not on aarch64. Compile-verification under a single platform's flags cannot prove an include is unused on other platforms, so the removal set was re-audited statically: a removal is kept only if the removed header declares no identifier (class, struct, enum, function, macro, alias) that is referenced anywhere in the file (including in #if-disabled regions). Result: 263 include lines removed from 193 files, pure deletions. pa-build passes; x86-gated files re-verified with the x86 toolchain.
Both are referenced under the macOS-only permissions code path: QPermission/QCameraPermission/QMicrophonePermission come from <QPermissions> (the file references the singular QPermission, which the header-name check missed), and qApp from <QApplication>.
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.
Removes
#includelines that are statically verifiable as unnecessary on every platform.Method
Each candidate removal (from an earlier compile-verified pass) was re-audited statically: an include is kept only if the removed header declares no identifier (class, struct, enum, function — declaration or definition, macro, or
usingalias) that is referenced anywhere in the file, including inside#if-disabled regions.This rule is platform-independent: a compile check under one platform's flags can prove nothing about includes that are only needed in code enabled on other platforms (e.g.
#ifdef PA_DPPregions on x86 CI, or headers whose names otherwise only resolve through platform-dependent transitive includes — the first CI pass caught exactly these:SpinPause.hinSpinLock.cppandDppClient.hinProgramNotifications.cpp).Headers that could not be proven unused by this rule were kept, including macro-gate providers,
.tpptemplate implementations, and platform backend headers.Verification
pa-buildpasses (full compile + link).Size
263 include lines removed from 193 files. Pure deletions — no lines added or reordered.