diff options
author | Nicolas Williams <nico@cryptonector.com> | 2017-02-04 00:11:10 -0600 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2017-02-04 00:11:10 -0600 |
commit | 125071cf005e687d4beba9d5822b1c6a72d7d14c (patch) | |
tree | 98bbc0beba737efc16c7d345b3c06c88302f5912 | |
parent | 2fb099e4cfe5a9fedd55a1ace44ae2c5ee02cb12 (diff) |
Fix handling of unsupported math functions
-rw-r--r-- | src/builtin.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/builtin.c b/src/builtin.c index 0fbeed51..520d77a2 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 |