From 35872f6415fd306eaf69363cc292c1af77100c0e Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Mon, 13 Jul 2026 10:11:25 +0900 Subject: [PATCH] Link, don't just compile, when probing compiler builtins have_builtin_func used try_compile, so on MSVC a bare implicit declaration of __builtin_clzll passes (C4013 is only a warning unless promoted to an error), HAVE_BUILTIN___BUILTIN_CLZLL gets defined, and the parser fails to link with LNK2019 for __builtin_clzll. try_link resolves the builtin inline on GCC/Clang and fails on MSVC, giving the correct answer on every toolchain regardless of warning flags. --- ext/json/ext/parser/extconf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/json/ext/parser/extconf.rb b/ext/json/ext/parser/extconf.rb index 9e141a72..91d2400b 100644 --- a/ext/json/ext/parser/extconf.rb +++ b/ext/json/ext/parser/extconf.rb @@ -17,7 +17,7 @@ def have_builtin_func(name, check_expr, opt = "", &b) checking_for checking_message(name.funcall_style, nil, opt) do - if try_compile(<