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
ARROW-9698: [C++] Remove -DNDEBUG flag leak in .pc file #7939
Conversation
I disagree with these changes. There no is reason to rename NDEBUG to another symbol. We should simply ensure that the ABI is the same with and without NDEBUG. |
It looks like the only place that would need fixing is in arrow/util/trie.h. |
(also, you forgot to change the |
Whoops, must have gotten lost when I revised my commit. Had it in the original. |
Actually, given the approach here, it wouldn't need to change -- my change would set a different flag rather than NDEBUG. In any case, this change was one approach suggested in the jira issue, but I am happy to change it. From the code you pointed out, the NDEBUG check could simply be removed (not sure why it is necessary, if NDEBUG would also disable the assert anyway?). Or, it could be moved inside of the function definition and break/do nothing. Thoughts or preferences? |
I don't know why @kou suggested the flag change. If I look at headers in As for |
@pitrou Why are the asserts wrapped in NDEBUG? Isn't that redundant? |
@bdunlay Where exactly? Do you have an example? |
For example the lines you pointed out to me: src/arrow/util/trie.h If this is a debug build, the function is included in the header, and the assert is evaluated. If it's a release build, the function is omitted, and the assert is obviously never evaluated. But if you removed the macro completely, in a release build, the function exist but would no-op (assert disabled). |
Ah, yes, you are right, in those cases the |
This change eliminates the need to include the -DNDEBUG flag in arrow's .pc file, which leaks into downstream projects' builds unexpectedly. The CheckSize function definition is now included in both debug and release builds, though it will no-op in release builds (as expected). The flag is no longer required as a means to make the ABI consistent across build types for downstream projects, and so it is now removed.
Think the linter is mad at me for an extra newline in the cmake file. Will remove that w/ an update once CI completes. |
I will push a new change with that newline removed, but the linter is going to complain anyway because there are lots of linting issues that are not compliant with the linter in that cmake file that existed prior to my change. |
If you installed archery, you can run |
I'll submit this for review as is if that's okay with you. |
Hey look at that, it's happy now 😄 |
I suggested the renaming approach because using release build libarrow.so without |
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.
+1, thank you @bdunlay
@github-actions crossbow submit -g linux |
This change eliminates the need to include the -DNDEBUG flag in arrow's .pc file, which leaks into downstream projects' builds unexpectedly. The CheckSize function definition is now included in both debug and release builds, though it will no-op in release builds (as expected). The flag is no longer required as a means to make the ABI consistent across build types for downstream projects, and so it is now removed. Closes apache#7939 from bdunlay/master Authored-by: Brian Dunlay <dunlaybd@amazon.com> Signed-off-by: Antoine Pitrou <antoine@python.org>
This change eliminates the need to include the -DNDEBUG flag in arrow's .pc file, which leaks into downstream projects' builds unexpectedly. The CheckSize function definition is now included in both debug and release builds, though it will no-op in release builds (as expected). The flag is no longer required as a means to make the ABI consistent across build types for downstream projects, and so it is now removed.