Calling the compiler is not enough to check whether a function exists because the compiler will assume an implicit declaration if the function does not exist. We need the linker to check if the function really exists.
Fix autoconf check for __builtin_expect #571
pull real-or-random wants to merge 1 commits into bitcoin-core:master from real-or-random:ac-link changing 1 files +1 −1-
real-or-random commented at 2:05 AM on October 31, 2018: contributor
-
e5a3d2135f
Fix autoconf check for __builtin_expect
Calling the compiler is not enough to check whether a function exists because the compiler will assume an implicit declaration if the function does not exist. We need the linker to check if the function really exists.
-
sipa commented at 2:10 AM on November 6, 2018: contributor
@real-or-random Eh,
__builtin_expectis expected to be a builtin for which no runtime symbol exists (you can't write&__builtin_expectfor example), so if it compiles, we should be fine.EDIT: Ah, this is about the case where it's not fine; good point.
ACK
-
gmaxwell commented at 7:10 PM on December 12, 2018: contributor
Or we could stop using autoconf for this and switch to compiler version sniffing, gnupreq 3 is sufficient for expect.
-
real-or-random commented at 8:18 PM on December 12, 2018: contributor
I don't know what gnupreq is but clang has __builtin_expect, too.
-
sipa commented at 1:43 AM on December 16, 2018: contributor
@real-or-random The code here: https://github.com/sipa/minisketch/blob/master/src/util.h#L10L23 works on clang too, I think.
-
real-or-random commented at 10:50 AM on December 17, 2018: contributor
Closed, #579 is better
- real-or-random closed this on Dec 17, 2018