-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Fix: OSX QT compile: use built-in swap if available, or defer #9366
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
|
Yes, this looks better, thanks |
src/test/bswap_protobuf_tests.cpp
Outdated
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'd prefer moving this one to the qt unit tests, instead of adding a qt-specific unit test to the core unit tests.
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 moved this into a new "CompatTests" test suite in the QT tests.
|
Hmm, is it really necessary to have the system-specific bswaps anymore? Since we require a modern compiler, these are likely to be detected/optimized automatically anyway. Test file: https://gist.github.com/theuni/deb0b97c31890bd0a06a65dd3cb51822 Results: https://gist.github.com/theuni/508b69da908be1e52bbdd0b7a135c318 On x86-64, I see no difference for osx+clang, linux+clang, linux+gcc. doesn't look like it's worth bothering to me, or is there some platform that would be more likely to be a discrepancy? |
|
@theuni So you think it's better to basically Edit: I meant to say that since we want the same thing to happen no matter which include order is taken, we might as well just redefine them each time on our own side. |
|
@kallewoof I was suggesting just skipping the platform includes (byteswap.h/OSByteOrder.h), skipping the use of any system implementations, and renaming bswap_foo -> int_bswap_foo to avoid collisions. Need others to chime in first though. |
|
FWIW I like the idea personally. |
1f8c454 to
609eb65
Compare
…ined. Defers to pre-defined version if found (e.g. protobuf). For protobuf case, the definitions are identical and thus include order should not affect results.
ef059d8 to
815f414
Compare
|
utACK 815f414 for the sake of fixing the build. Dropping the system includes (or alternatively autoconfing this) can come as a next step if it's agreed upon. |
If there are bswap primitives, I think we should use them. This is used internally in the serialization as well as crypto operations, so performance here (if there is a compiler where it makes sense) does matter. |
|
utACK 815f414, let's just fix this to fix the build, I think we've been through enough shed-painting here. |
…defer 815f414 Uses built-in byte swap if available (Apple) and if bswap_XX is undefined. (Karl-Johan Alm)
|
FYI, I backported this to 0.13. I noticed it when trying to compile the Elements Alpha refresh. |
…defer 815f414 Uses built-in byte swap if available (Apple) and if bswap_XX is undefined. (Karl-Johan Alm)
Fix macosx build (backport core #9169 and #9366)
This was originally added in bitcoin#9366 to fix the gui build, as Protobuf would also define these macros. Now that we're no-longer using Protobuf, remove the additional check.
This was originally added in bitcoin#9366 to fix the gui build, as Protobuf would also define these macros. Now that we're no-longer using Protobuf, remove the additional check.
-BEGIN VERIFY SCRIPT- sed -i 's/__APPLE__/MAC_OSX/g' src/compat/byteswap.h src/util.cpp -END VERIFY SCRIPT- Zcash: Excludes byteswap.h change as we don't have bitcoin/bitcoin#9366.
This was originally added in bitcoin#9366 to fix the gui build, as Protobuf would also define these macros. Now that we're no-longer using Protobuf, remove the additional check.
These were added as part of bitcoin#9366 to fix issues with Protobuf. Now that we no-longer use Protobuf, there's no reason to maintain a duplicate set of byteswap tests for qt.
9ac86bc test: remove qt byteswap compattests (fanquake) Pull request description: These were added as part of bitcoin#9366 when with fixing issues with Protobuf. Now that we no-longer use Protobuf, there's no reason to maintain a duplicate set of byteswap tests in the qt tests. Our other set of byteswap tests are here: https://github.com/bitcoin/bitcoin/blob/master/src/test/bswap_tests.cpp. ACKs for top commit: laanwj: Code review ACK 9ac86bc Tree-SHA512: 72ba131a5f8fbd9fdbbc4e1f95baa794496c960b12e0271700c632c6511b7e1b331e8db07a201838b4d56b2aeeb43d4de4e10265ea07ab14241307fa14d3342e
This was originally added in bitcoin#9366 to fix the gui build, as Protobuf would also define these macros. Now that we're no-longer using Protobuf, remove the additional check.
Uses built-in byte swap if available (Apple) and if
bswap_XXis undefined.Defers to pre-defined version if found (e.g. protobuf). For protobuf case, the definitions are identical and thus include order should not affect results.
Fixes compilation errors on recent Mac OS X with QT client enabled.
Replaces #9361