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.
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
Change usage of _PSTL_UD[R/S]_PRESENT macros #1551
Change usage of _PSTL_UD[R/S]_PRESENT macros #1551
Changes from 2 commits
7d1acc3
cade943
5c30bcc
b0f973e
a04cadc
05361f1
cd5716c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
extra space
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.
Fixed.
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.
I think this doesn't do what we are advertising by the name (and we want the semantics of the name I think).
_PSTL_UDS_PRESENT
is defined to empty in the external std lib def when it is "true" and left undefined when it is "false".This macro will convert that empty string to a "false" rather than a "true".
I think we want it to be "true" / "1" any time it is defined and not explicitly set to "0".
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.
Yes, you are correct. This macro should be truthy if the input is defined and empty, but that is not the case here.
I made this godbolt to try to write a macro that has all of the properties that we want, but I cannot come up with a macro that satisfies everything. So perhaps the original version of the PR is the solution that we should go with for now.
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.
Yeah, this is kind of an annoying case.
How about this:
https://godbolt.org/z/GY1qTjb5e
It would require basically converting the public pstl defines to our own local copy of the pstl defines (which would be "0" or "1"), then we could use our own copy as "normal".
Its possible that we could work it out so that our local
_ONEDPL_UDS_PRESENT
is our "local" copy, where we only attempt to define it ourselves if it is undefined.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.
After some offline discussion, @danhoeflinger and I arrived at a version of the macro that now correctly determines if the input define is either 1 or defined but empty.