GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Rescan substituted macro arguments so deferred calls expand like gcc by pfultz2 · Pull Request #713 · cppcheck-opensource/simplecpp Conversation
Contributor
A function-like macro name that only becomes a call after its neighbours were substituted was never expanded. This fixes #226. #define EMPTY() #define EVAL(...) __VA_ARGS__ #define HELLO() "Hello World" EVAL ( HELLO EMPTY() () ) simplecpp produced
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
dmcppcheck
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI review I found no wrong output that this PR introduces. In about 22,000 fuzzed inputs and in all my hand-written cases it never gave output that differs from gcc where base matched gcc. It fixes a lot: There are two new findings:
TestingBuild and suites (pr/):
I also built base/. Differential tests against
Fuzzing: I generated random token sequences over about 20 macros, including deferring and self-referencing ones. There were about 22,000 inputs in total, and I compared pr, base and gcc for each. There were 0 cases where base matched gcc and pr did not. The only mismatches were cases where base was wrong too, mostly "Wrong number of parameters" errors that both versions give. Gap that is still there (base gives the same output): #define ID(x) x #define F(x) [x] #define LP ( #define A(f,x) f x 1) a: A(F, (LP))
Performance: I timed
Automated review of 15f01b8 by Claude. The pull request was built and tested locally.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI review This rescan runs for every argument that contains any macro name, even when pre-expansion left nothing to find. The usual
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI review This rescan only sees the parameter's expansion. When the expansion opens a call that the replacement list closes later, the call is not found. With
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
dmcppcheck
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI review New regression: The two earlier points are still open: the extra rescan cost on nested arguments (C3) and the Earlier comments
@pfultz2, please fix, resolve or reply to the open comments: #1, #2. TestingBuild and suites (pr/):
I also built base/ to compare. Hand-written cases: these match gcc. They cover Fuzzing: about 9,000 gcc-valid random token sequences over 20 macros ( Regression with #define F(x) [x] #define E #define ID(x) x #define B(f,a,x) f a ## x 1: B(F, (1) E, Z) #define A(f,x,y) f x ## y 3: A(F, E (3), ) 4: ID(A(F, E (4), ))
For line 1 the PR drops the Earlier points rechecked:
Automated review of e1fe1ab by Claude. The pull request was built and tested locally.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI review
#define F(x) [x] #define E #define B(f,a,x) f a ## x #define A(f,x,y) f x ## y B(F, (1) E, Z) A(F, E (3), )
In the first line the pasted
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
dmcppcheck
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI review I found no new problems. The Earlier comments
@pfultz2, please fix, resolve or reply to the open comments: #3, #4. TestingBuild and suites (pr/):
I built base/ too, to compare. Hand-written cases in scratch/q.c, r.c, s.c, u.c and v.c, about 60 lines in total, compared with
All of these match gcc. In about 20 of them base was wrong. Recursion: Performance (C3): 100 lines of Still open (C7): #define F(x) [x] #define E #define B(f,a,x) f a ## x 1: B(F, (1) E, Z) #define A(f,x,y) f x ## y 3: A(F, E (3), )
Same in base, so not a regression: Automated review of 08c7c43 by Claude. The pull request was built and tested locally.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
5 tasks
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
dmcppcheck
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI review I found no new problems. One earlier finding is still there: the The other two earlier points are fixed:
My hand-written cases and about 3,800 fuzzed inputs that gcc accepts found no output that differs from gcc where base matched gcc. Earlier comments
@pfultz2, please fix, resolve or reply to the open comments: #3. TestingBuild and test suites (pr/):
I also built base/ to compare. Earlier points rechecked ( #define F(x) [x] #define E #define ID(x) x #define B(f,a,x) f a ## x 1: B(F, (1) E, Z) #define A(f,x,y) f x ## y 3: A(F, E (3), ) 4: ID(A(F, E (4), )) #define LP ( #define A2(f,x) f x 1) 5: A2(F, (LP))
C7 is still open (lines 1 and 3). C4 is fixed (line 5). Hand-written cases (
Several of these were wrong in base and are now correct. Fuzzing: I generated random Performance (outputs of base and pr are identical):
Automated review of 8ea6017 by Claude. The pull request was built and tested locally.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. EVAL(...) not workingUh oh!
There was an error while loading. Please reload this page. 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. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |