Repository navigation
claw: gates.t27 compares strings with str_eq and lengths, so gates.c has no literal pointer compares - #10703
Merged
Conversation
…has no literal pointer compares gen-c lowers `==` on str to a C pointer comparison (#8013). After #10696 the regenerated gen/c/claw/gates.c still had 16 such compares, all in test functions. Each string assertion now goes through text::str_eq with explicit lengths. The new events_len_of(name, name_len), which returns EVENT_LENS[i] or 0 for an unknown name, replaces `events_of(x) == ""`. A new test drives all 67 rows through events_len_of. gen/c/claw/gates.c is regenerated by t27c gen-c. Closes #10698 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
October 18, 2026 22:53
Contributor
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
This finishes #10696. gen-c lowers
==onstrto a C pointer comparison (#8013). The regeneratedgen/c/claw/gates.cstill had 16 such compares, all in test functions. This PR rewrites them throughtext::str_eqwith explicit lengths.rows_stay_aligned_name_class_eventsNAMES[1] == want1,events_of(qp, 13) == ev_qpstr_eq(NAMES[1], NAME_LENS[1], want1, 20),str_eq(events_of(qp, 13), events_len_of(qp, 13), ev_qp, 31)unknown_name_is_unknown_and_not_blockingevents_of("no-such-gate", 12) == ""events_len_of("no-such-gate", 12) == 0audit_prefixes_name_the_problem_kindspec_only == "SPEC-ONLY ",ok == "", ...str_eq(LINE_PREFIX[k], PREFIX_LENS[k], "...", n),PREFIX_LENS[P_OK] == 0soft_gates_report_their_eventsevents_of("oracle-nightly", 14) == "..."str_eq(events_of(..), events_len_of(..), "...", 26)New production function:
events_len_of(name, name_len) -> usize, which returnsEVENT_LENS[i]for a known name and 0 otherwise. New test:events_len_of_answers_every_rowdrives all 67 rows through it.Verification (Railway lab)
test-reportand t27b: gates 24/24 (23 before, 1 new), gates_pins 6/6, service 8/8, preview 19/19, verified/gen_file_check 12/12. 0 vacuous passes.cc -Wall"comparison with string literal" warnings on gates.c: 16 before, 0 after. All warnings: 107 before, 91 after.events_len_ofreading NAME_LENS instead of EVENT_LENS;0..66.DRIFT_TAILconstant, so it survived. Rerun on the test line only, it was caught..github/workflowslisting printsclaw: matrix is currentand exits 0.seal --savefor gates, thenseal --verify: 32 of 32 match.Left, emitter-side (Rust, not touched)
The 91 warnings that remain on gates.c are all emitter defects: 70
incompatible-pointer-types, 16discarded-qualifiersand 5duplicate-decl-specifier. The last is #10645.Closes #10698
🤖 Generated with Claude Code