ci(conventions): reject alignas above the 8192 bytes MinGW allows #9150
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9150"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by gdols on 2026-10-21T13:38:42Z.
What
Adds an
alignmentrule to the Conventions check: an added C++ line withalignasabove 8192 fails, whether the argument is an integer literal (decimal, hex, binary or octal, with digit separators and suffixes) or aconstexprinteger constant of the same file. A constant is taken from the definition visible at thatalignas: the latest one before it in the innermost scope that encloses it, so same-named constants in other functions or blocks don't count. A namespace keeps its identity across reopened blocks, an inline namespace belongs to its parent and anextern "C"block opens no scope.The required WinLibs GCC 15.2.0 r7 rejects static objects aligned above 8192 bytes (
requested alignment '65536' exceeds object file maximum 8192). Linux builds accept them, Windows CI builds only three AGC execution tests, and full builds run on pull requests only on request, so these reachmain. Run on the commits ofmainthat added one, the rule reports each of them:d31e35e1a:Flip.cpp:53 alignas(65536)bbde0f468:ColorTargetLayout.cpp:58 alignas(65536)c10401e39:ImageXorSwizzleVolume.cpp:34 alignas(65536)6b14169a4:GpuIndirectArgumentsMisalignedWriterAhead.cpp:25 alignas(BlockBytes)(#6716)ed599f525:ImageArrayWindowPastLayerLimit.cpp:33 alignas(65536), fixed by #8310#8310 removed the last one, so on current
mainthe rule reports nothing.Measured with GCC 15.2.0 r7: a namespace-scope object, a
staticlocal and a namespace-scope object of an over-aligned type fail above 8192; an automatic local, a member and a heap-allocated over-aligned type build. The rule reports thealignasitself, so it would also report those three; none exists onmain. CONTRIBUTING states the limit next to the extensions rule.Tested
Windows 11 Pro 26300, Python 3.13.14, WinLibs GCC 15.2.0 r7, on
main1c6e10f17.tools/tests/test_check_conventions_alignment.py: 9 tests pass, including same-named constants in separate and in nested scopes in both orders, and constants of reopened, nested and inline namespaces and ofextern "C"blocks. With the limit raised so the rule never fires, 21 of its checks fail; with the earlier file-wide lookup, the scope test throughCheck.code()fails.tools/tests/test_check_conventions_*.pypasses, and so doestools/check_test_registration.py --scripts.main1c6e10f17it reports nothing. Resolving constants and checking every line takes 0.20 s for the slowest file, the 12,253-linetests/Graphics.cpp(best of three), and 2.8 s for all 606 files withalignas.g++ -std=c++20 -O2 -c.tools/check_conventions.py --base origin/mainwith this title and description,tools/check_main_sync.pyandtools/pr_overlap.py --branchpass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)