Skip to content

Issue 47#50

Merged
pmbittner merged 23 commits into
developfrom
issue47
Nov 3, 2022
Merged

Issue 47#50
pmbittner merged 23 commits into
developfrom
issue47

Conversation

@pmbittner
Copy link
Copy Markdown
Member

@pmbittner pmbittner commented Sep 23, 2022

Fixes for two parser bugs documented in issue #47 . Documentation is still missing but should be added.

@pmbittner pmbittner self-assigned this Sep 23, 2022
@pmbittner pmbittner linked an issue Sep 23, 2022 that may be closed by this pull request
@pmbittner pmbittner changed the base branch from main to develop September 23, 2022 14:38
@pmbittner pmbittner requested a review from ibbem October 6, 2022 11:25
@pmbittner pmbittner added the bug Something isn't working label Oct 6, 2022
Copy link
Copy Markdown
Collaborator

@ibbem ibbem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you notice the failing test in CI?
DiffNode.assertConsistency fails (because of a missing feature mapping) for LineGraphTest.idempotentReadWrite() with file src/test/resources/line_graph/vulkan_structs.hpp\$\$\$fd641ac85c6170c34845db5e345d3bf9cedce8d7.lg.
This test case should be adjusted somehow.

Comment thread src/main/java/org/variantsync/diffdetective/diff/GitPatch.java Outdated
Comment thread src/main/java/org/variantsync/diffdetective/diff/GitPatch.java Outdated
Comment thread src/main/java/org/variantsync/diffdetective/diff/difftree/DiffTree.java Outdated
Comment thread src/main/java/org/variantsync/diffdetective/diff/difftree/DiffTree.java Outdated
Comment thread src/main/java/org/variantsync/diffdetective/diff/result/CommitDiffResult.java Outdated
Comment thread src/test/java/CPPParserTest.java Outdated
Comment thread src/test/java/CPPParserTest.java Outdated
Comment thread src/test/java/CPPParserTest.java Outdated
Comment thread src/main/java/org/variantsync/diffdetective/diff/result/CommitDiffResult.java Outdated
ibbem added 7 commits October 18, 2022 21:05
For example `#if defined()` was accepted.
In general, `HashMap`s are not deterministic because the default
implementation of the hash function might not be deterministic (as in,
for example, openjdk 18.0.2). This matters in this case because it's
incorrect to replace '>' before '>='.
According to C11, constant expressions (used in macro conditions) can
contain all operators available in normal code except assignment,
increment, decrement, function-call, or comma operators. (§ 6.6
paragraph 3)
An example where this now works is `#ifdef ifndef`.
Previously, the macro `#if defined A` was not parsed correctly because
first the space was removed and afterwards it was tried to replace the
`defined` operator.
Note: This changes the abstracted names of macro calls in an backwards
incompatible way.
@ibbem
Copy link
Copy Markdown
Collaborator

ibbem commented Oct 18, 2022

I just fixed the above mentioned parser issues. During coding/testing I found some more issues, some of them are already fixed. (Test cases follow later because I based them on #54 for easier testing.)

There are still unsolved problems:

  • The C11 standard allows character literals besides integers which are currently not handled at all.
  • The bracket replacement is more a heuristic than a robust algorithm, for example #if B - (C || D) is not parsed correctly.

@TheBormann You can try to merge this again, I hope this fixes some issues for you.

@pmbittner
Copy link
Copy Markdown
Member Author

Hi @ibbem ,

thank you very much for your good review! I finally answered to your comments. Given that your upgrade to JUnit5 is now merged into develop and that you already fixed some comments here, could you

  1. merge develop,
  2. resolve all conversations above that your commits already addresses, and
  3. take care of the concerns raised in the other comments? I agree with most of them.

Thank you very much.

@pmbittner
Copy link
Copy Markdown
Member Author

Oops, I confused the other two pull-requests but the pull-request for JUnit5 is going to merged soon. :)

@pmbittner pmbittner added the bm_work ibbem is paid for working on this label Oct 25, 2022
@pmbittner
Copy link
Copy Markdown
Member Author

PR #54 is now merged.

@ibbem ibbem force-pushed the issue47 branch 2 times, most recently from 6380363 to 0388513 Compare November 2, 2022 19:48
@ibbem
Copy link
Copy Markdown
Collaborator

ibbem commented Nov 2, 2022

I replaced your tests with the test suite I wrote and moved the above mentioned problems into wontfix tests.

The test cases which was failing actually indicated a problem in the DiffNode.fromID function: It can't assign a meaningful feature mapping to the created node. As this function doesn't guarantee that it recovers all information I just used True to satisfy assertConsistency.

@ibbem
Copy link
Copy Markdown
Collaborator

ibbem commented Nov 2, 2022

@pmbittner I don't know why, but I'm unable to request a review from you. So I just inform you that I finished working on this PR.

@pmbittner
Copy link
Copy Markdown
Member Author

Thank you for all the fixes! The change to using True in DiffNode.fromID makes sense as it is the neutral element for presence conditions. However, please use org.variantsync.diffdetective.util.fide.FixTrueFalse.True here. It is actually the same value but we use it as a constant across the entire project because there are some bugs in FeatureIDE handling True and False correctly upon SAT-Solving. That way, we have a consistent treatment of True and False across DiffDetective until the bug is fixed or until we migrate to FeatJar.

Copy link
Copy Markdown
Member Author

@pmbittner pmbittner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great! Only minor comments. Thank you very much! :)

You could not request a review from me because I am the author of the pull-request. 😅

Comment thread src/main/java/org/variantsync/diffdetective/diff/PatchReference.java Outdated
Comment thread src/main/java/org/variantsync/diffdetective/diff/difftree/DiffNode.java Outdated
Comment thread src/main/java/org/variantsync/diffdetective/feature/BooleanAbstraction.java Outdated
ibbem added 7 commits November 3, 2022 11:25
There are many methods that just return garbage data and it's not
documented that they may be unsupported. This also makes the interface
for `DiffTree.fromPatch` more intuitive (I initially thought that it
would take the diff from `PatchReference.getDiff`).
CommitDiffResult is not a good place to have such methods because its
unexpected to have such convenience methods in the error handling type.
Also, there are already many such convenience methods in `GitDiffer`
most prominently `createCommitDiff` which does almost exactly what the
moved method does, except it expects a `RevCommit` instead if a hash.
@ibbem
Copy link
Copy Markdown
Collaborator

ibbem commented Nov 3, 2022

@pmbittner All the above mentioned issues are fixed now.

@pmbittner
Copy link
Copy Markdown
Member Author

Now only you have to approve the changes because initially you were the reviewer. ;) Afterwards, we can merge.

@ibbem ibbem self-requested a review November 3, 2022 14:52
Copy link
Copy Markdown
Collaborator

@ibbem ibbem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my point of view, this is good to go.

@pmbittner pmbittner merged commit 93f836e into develop Nov 3, 2022
@ibbem ibbem deleted the issue47 branch November 15, 2022 16:36
@ibbem ibbem mentioned this pull request Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bm_work ibbem is paid for working on this bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Brackets in variable names upon boolean abstraction

2 participants