Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -Wparentheses warning in synthesized C++ code #2202

Merged

Conversation

luc-tielen
Copy link
Contributor

Resolves #2194. I compiled souffle twice, and ran souffle -g path.{cpp,dl} before and after on the following Datalog snippet:

.decl edge(x: symbol, y: symbol)
.decl reachable(x: symbol, y: symbol)

.input edge
.output reachable

reachable(x, y) :-
  edge(x, y).

reachable(x, y) :-
  edge(x, z),
  reachable(z, y).

And then diff shows the following:

$ diff path.cpp.old path.cpp.new
17c17
<   return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0]))|| (ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0])) && ((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1])));
---
>   return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0]))|| ((ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0])) && ((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1]))));
120c120
<   return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0]))|| (ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0])) && ((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1])));
---
>   return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0]))|| ((ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0])) && ((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1]))));

@codecov
Copy link

codecov bot commented Mar 8, 2022

Codecov Report

Merging #2202 (8893fe8) into master (6c731e5) will decrease coverage by 0.06%.
The diff coverage is 83.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2202      +/-   ##
==========================================
- Coverage   75.58%   75.52%   -0.07%     
==========================================
  Files         452      452              
  Lines       27266    27394     +128     
==========================================
+ Hits        20609    20689      +80     
- Misses       6657     6705      +48     
Impacted Files Coverage Δ
src/ast/analysis/typesystem/TypeSystem.h 84.33% <ø> (ø)
src/ast/analysis/typesystem/Type.cpp 45.84% <50.00%> (ø)
src/interpreter/Engine.cpp 87.42% <72.94%> (-2.55%) ⬇️
src/interpreter/Generator.cpp 94.85% <80.00%> (-1.03%) ⬇️
src/ast/analysis/typesystem/TypeSystem.cpp 74.31% <86.84%> (-0.44%) ⬇️
...ast/analysis/typesystem/TypeConstrainsAnalysis.cpp 99.31% <100.00%> (ø)
src/ast/analysis/typesystem/TypeConstraints.cpp 90.11% <100.00%> (+0.41%) ⬆️
src/ast/transform/IOAttributes.h 97.74% <100.00%> (+0.10%) ⬆️
src/ast/transform/TypeChecker.cpp 88.68% <100.00%> (ø)
src/interpreter/Node.h 98.02% <100.00%> (+0.16%) ⬆️
... and 7 more

@XiaowenHu96
Copy link
Collaborator

Thanks for this.

@XiaowenHu96 XiaowenHu96 merged commit 2fdbd07 into souffle-lang:master Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning about missing parentheses in generated code.
2 participants