mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 10:03:23 +09:00
[Refactor] (P13 W5 S8): MOBILEGL_BUILD_RECORD_ARM is folded away - the record arm is unconditional - and retired_switches keeps it from coming back.
This commit is contained in:
@@ -23,6 +23,9 @@ RULES = (
|
||||
'MOBILEGL_PIPE_LEGACY_MEMOS)'),
|
||||
(re.compile(r'\bMGB_CTX(?:_LIVE|_IDENTITY)?\b'),
|
||||
'MGB_CTX is back; backends read MG_Pipe::gPipeInputs directly since P13 W3b'),
|
||||
(re.compile(r'^\s*#\s*(?:if|ifdef|ifndef|elif)\b.*\bMOBILEGL_BUILD_RECORD_ARM\b'),
|
||||
'a preprocessor conditional names MOBILEGL_BUILD_RECORD_ARM, folded away at P13 W5 S8 - the '
|
||||
'record arm is in every library; a transport-only block takes MOBILEGL_BUILD_DISAGGREGATED'),
|
||||
)
|
||||
|
||||
|
||||
@@ -49,12 +52,15 @@ def self_test():
|
||||
planted = [('planted.cpp', '#if MOBILEGL_PIPE_PUSH\nx();\n#endif\n'),
|
||||
('planted.h', ' # elif !MOBILEGL_PIPE_LEGACY_MEMOS && FOO\n'),
|
||||
('planted.inc', 'auto v = MGB_CTX->GetX();\n'),
|
||||
('planted2.cpp', 'if (MGB_CTX_LIVE) {}\n')]
|
||||
('planted2.cpp', 'if (MGB_CTX_LIVE) {}\n'),
|
||||
('planted3.cpp', '#if MOBILEGL_BUILD_RECORD_ARM && MOBILEGL_PIPE_POISON\n'),
|
||||
('planted4.h', '#elif !MOBILEGL_BUILD_RECORD_ARM\n')]
|
||||
for item in planted:
|
||||
assert scan([item]), f'the gate missed a planted line: {item}'
|
||||
clean = [('clean.cpp', 'features.PipePush = QueryEnvUint64("MOBILEGL_PIPE_PUSH", 0x3fff);\n'),
|
||||
('clean.h', '// MOBILEGL_PIPE_PUSH=0x7f was the P2 mask\n'),
|
||||
('clean.inc', 'MG_Pipe::gPipeInputs.GetX();\n')]
|
||||
('clean.inc', 'MG_Pipe::gPipeInputs.GetX();\n'),
|
||||
('clean2.cpp', '// MOBILEGL_BUILD_RECORD_ARM was W5\'s temporary guard\n')]
|
||||
for item in clean:
|
||||
assert not scan([item]), f'the gate fired on a legitimate line: {item}'
|
||||
print(f'retired switches self-test: {len(planted)} planted lines caught, {len(clean)} clean lines left alone')
|
||||
@@ -68,7 +74,8 @@ def main():
|
||||
print(f'::error::{line}')
|
||||
if findings:
|
||||
return 1
|
||||
print('retired switches: none of MOBILEGL_PIPE_PUSH / MOBILEGL_PIPE_LEGACY_MEMOS (as #if) or MGB_CTX in source')
|
||||
print('retired switches: none of MOBILEGL_PIPE_PUSH / MOBILEGL_PIPE_LEGACY_MEMOS / MOBILEGL_BUILD_RECORD_ARM '
|
||||
'(as #if) or MGB_CTX in source')
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -82,9 +82,7 @@ FLOW_STOP = re.compile(r"^\s*(?:case\b|default\s*:|break\s*;|return\b|continue\s
|
||||
PP_OPEN = re.compile(r"^\s*#\s*(?:if|ifdef|ifndef)\b")
|
||||
PP_CLOSE = re.compile(r"^\s*#\s*endif\b")
|
||||
PP_STOP = re.compile(r"^\s*#\s*(?:else|elif)\b")
|
||||
# P13 W5: the record arm's own guard, MOBILEGL_BUILD_RECORD_ARM, is the same build-selecting kind of
|
||||
# opener (it equals the disaggregated build until W5's flip and is unifdef'd away after it).
|
||||
PP_DISAGGREGATED = re.compile(r"^\s*#\s*(?:if|ifdef)\s+MOBILEGL_BUILD_(?:DISAGGREGATED|RECORD_ARM)\s*$")
|
||||
PP_DISAGGREGATED = re.compile(r"^\s*#\s*(?:if|ifdef)\s+MOBILEGL_BUILD_DISAGGREGATED\s*$")
|
||||
|
||||
|
||||
def strip_code(text: str) -> str:
|
||||
@@ -361,24 +359,6 @@ SELF_TEST_FIXTURES = (
|
||||
"#endif\n"
|
||||
" WireDeclineTally::Count(WireDeclineSite::GhostRow);\n"
|
||||
"}\n", 1, NO_LOG),
|
||||
("log only on the other side of a RECORD_ARM #else", _DEF_GHOST,
|
||||
"void F(int x) {\n"
|
||||
"#if MOBILEGL_BUILD_RECORD_ARM\n"
|
||||
" MGLOG_W(\"x\");\n"
|
||||
"#else\n"
|
||||
" MGLOG_D(\"compiled away\");\n"
|
||||
"#endif\n"
|
||||
" WireDeclineTally::Count(WireDeclineSite::GhostRow);\n"
|
||||
"}\n", 1, NO_LOG),
|
||||
("count under its log across a column-0 RECORD_ARM #if/#endif", _DEF_GHOST,
|
||||
"void F(int x) {\n"
|
||||
" if (x) {\n"
|
||||
" MGLOG_W(\"x\");\n"
|
||||
"#if MOBILEGL_BUILD_RECORD_ARM\n"
|
||||
" WireDeclineTally::Count(WireDeclineSite::GhostRow);\n"
|
||||
"#endif\n"
|
||||
" }\n"
|
||||
"}\n", 0, "0 unlogged, 0 unknown"),
|
||||
("log only under a #if 0 above the Count", _DEF_GHOST,
|
||||
"void F(int x) {\n"
|
||||
" if (x) {\n"
|
||||
|
||||
Reference in New Issue
Block a user