mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-25 02:47:54 -04:00
Require the __builtin functions unconditionally
Currently following __builtin functions are used:
__builtin_add_overflow
__builtin_mul_overflow
__builtin_prefetch
__builtin_sub_overflow
__builtin_unreachable
These are generally available on our supported platform, and also we use
some of these unconditionally anyway in qp.c. Thus make the support for
these functions mandatory so we fail early in the 'setup' step.
This commit is contained in:
parent
56704f4bfb
commit
40fda03e50
2 changed files with 4 additions and 20 deletions
|
|
@ -39,29 +39,11 @@
|
|||
* INSIST(!overflow);
|
||||
*/
|
||||
|
||||
#if HAVE_BUILTIN_MUL_OVERFLOW
|
||||
#define ISC_OVERFLOW_MUL(a, b, cp) __builtin_mul_overflow(a, b, cp)
|
||||
#else
|
||||
#define ISC_OVERFLOW_MUL(a, b, cp) \
|
||||
((ISC_OVERFLOW_UINT_MAX(a) / (b) > (a)) ? (*(cp) = (a) * (b), false) \
|
||||
: true)
|
||||
#endif
|
||||
|
||||
#if HAVE_BUILTIN_ADD_OVERFLOW
|
||||
#define ISC_OVERFLOW_ADD(a, b, cp) __builtin_add_overflow(a, b, cp)
|
||||
#else
|
||||
#define ISC_OVERFLOW_ADD(a, b, cp) \
|
||||
((ISC_OVERFLOW_UINT_MAX(a) - (b) > (a)) ? (*(cp) = (a) + (b), false) \
|
||||
: true)
|
||||
#endif
|
||||
|
||||
#if HAVE_BUILTIN_SUB_OVERFLOW
|
||||
#define ISC_OVERFLOW_SUB(a, b, cp) __builtin_sub_overflow(a, b, cp)
|
||||
#else
|
||||
#define ISC_OVERFLOW_SUB(a, b, cp) \
|
||||
((ISC_OVERFLOW_UINT_MIN(a) + (b) < (a)) ? (*(cp) = (a) - (b), false) \
|
||||
: true)
|
||||
#endif
|
||||
|
||||
#define ISC_CHECKED_MUL(a, b) \
|
||||
({ \
|
||||
|
|
|
|||
|
|
@ -316,12 +316,14 @@ endif
|
|||
|
||||
foreach fn : [
|
||||
'__builtin_add_overflow',
|
||||
'__builtin_expect',
|
||||
'__builtin_mul_overflow',
|
||||
'__builtin_prefetch',
|
||||
'__builtin_sub_overflow',
|
||||
'__builtin_unreachable',
|
||||
]
|
||||
if cc.has_function(fn)
|
||||
config.set('HAVE_@0@'.format(fn.substring(2).to_upper()), 1)
|
||||
if not cc.has_function(fn)
|
||||
error('@0@ support required'.format(fn))
|
||||
endif
|
||||
endforeach
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue