-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm-rc] Add support for multiplication and division in expressions #143373
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
Conversation
I was wondering if we should handle operator precedence correctly, like in I'm not sure what the best approach is here, what do you think? |
Oh, that's indeed a good point, thanks for catching it! That's weird if rc.exe does accept them but actually doesn't act on them. So perhaps they're not really a thing in canonical MS rc files - I guess that's why they're not implemented so far. The case where I ran into this, https://github.com/DerellLicht/winwiz/blob/ed4134c44c22acc3746228eec34538d1e857dd6c/winwiz.rc#L250-L253, has parentheses so it should be unambiguous anyway (I think, or does it not honor them correctly either?), but if we do implement them I do think we should get the precedence right as well. |
8fc8081
to
217d30b
Compare
Thanks, now it should handle operator precedence correctly. (It may have been possible to handle this by sticking to two levels of expression evaluation, but for clarity, I made a second level inbetween the preexisting low precendence binary operators, and the existing unary operators.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me, but please update the parser summary comment above RCParser::readInt
.
This is supported by GNU windres. MS rc.exe does accept these expressions, but doesn't evalulate them correctly, it only returns the left hand side. This fixes one aspect of llvm#143157.
217d30b
to
d04c540
Compare
Thanks for catching this detail as well! Updated now, will push later today. |
…lvm#143373) This is supported by GNU windres. MS rc.exe does accept these expressions, but doesn't evalulate them correctly, it only returns the left hand side. This fixes one aspect of llvm#143157.
…lvm#143373) This is supported by GNU windres. MS rc.exe does accept these expressions, but doesn't evalulate them correctly, it only returns the left hand side. This fixes one aspect of llvm#143157.
…lvm#143373) This is supported by GNU windres. MS rc.exe does accept these expressions, but doesn't evalulate them correctly, it only returns the left hand side. This fixes one aspect of llvm#143157.
This is supported by GNU windres. MS rc.exe does accept these expressions, but doesn't evalulate them correctly, it only returns the left hand side.
This fixes one aspect of #143157.