From: Nicolas Williams Date: Sat, 4 Feb 2017 06:11:10 +0000 (-0600) Subject: Fix handling of unsupported math functions X-Git-Tag: jq-1.6rc1~83 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=125071cf005e687d4beba9d5822b1c6a72d7d14c;p=jq Fix handling of unsupported math functions --- diff --git a/src/builtin.c b/src/builtin.c index 0fbeed5..520d77a 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -1375,12 +1375,25 @@ static block bind_bytecoded_builtins(block b) { #define LIBM_DD(name) "def " #name ": _" #name ";" #define LIBM_DDD(name) "def " #name "(a;b): _" #name "(a;b);" -#define LIBM_DD_NO(name) "def " #name ": \"Error: " #name "() not found at build time\"|error;" -#define LIBM_DDD_NO(name) "def " #name "(a;b): \"Error: " #name "() not found at build time\"|error;" +#define LIBM_DD_NO(name) +#define LIBM_DDD_NO(name) static const char* const jq_builtins = +/* Include supported math functions first */ #include "libm.h" +/* Include jq-coded builtins next (some depend on math) */ #include "src/builtin.inc" + +/* Include unsupported math functions next */ +#undef LIBM_DDD_NO +#undef LIBM_DD_NO +#undef LIBM_DDD +#undef LIBM_DD +#define LIBM_DD(name) +#define LIBM_DDD(name) +#define LIBM_DD_NO(name) "def " #name ": \"Error: " #name "() not found at build time\"|error;" +#define LIBM_DDD_NO(name) "def " #name "(a;b): \"Error: " #name "() not found at build time\"|error;" +#include "libm.h" ; #undef LIBM_DDD_NO