error: use of unknown builtin '__builtin_add_overflow'
ryandesign opened this issue · 1 comments
ChezScheme 10.0.0 fails to build with Apple Clang versions earlier than 800:
c/pb.c:122:10: error: use of unknown builtin '__builtin_add_overflow' [-Wimplicit-function-declaration]
case COMMON_INSTR(pb_bin_op_pb_signal_pb_add_pb_register)
^
c/pb.c:51:28: note: expanded from macro 'COMMON_INSTR'
#define COMMON_INSTR(x) x: doi_ ## x(instr); break;
^
<scratch space>:73:1: note: expanded from here
doi_pb_bin_op_pb_signal_pb_add_pb_register
^
c/pb.h:384:4: note: expanded from macro 'doi_pb_bin_op_pb_signal_pb_add_pb_register'
do_pb_bin_op_pb_signal_pb_add_pb_register(INSTR_drr_dest(instr), INSTR_drr_reg1(instr), INSTR_drr_reg2(instr))
^
c/pb.h:390:12: note: expanded from macro 'do_pb_bin_op_pb_signal_pb_add_pb_register'
flag = __builtin_add_overflow(a, b, &r); \
^
This was reported to MacPorts here: https://trac.macports.org/ticket/70278
You use __builtin_add_overflow
if USE_OVERFLOW_INTRINSICS
is defined:
Lines 382 to 404 in 3d1579e
And you defined it for gcc 5 or greater or any version of clang:
Lines 74 to 78 in 3d1579e
But older versions of clang don't support it. Instead of relying on compiler version numbers (which is complicated to get right for clang, since there are two different clangs, one released by llvm.org, the other released by Apple, with different version numbering schemes), please use a method like __has_builtin
to discover whether it is available.