Skip to contentSkip to conversation

Revert "jq: fix build with gcc-15"

PATCH In review Khem Raj 2 participants 3 messages Mar 27, 2025 – Mar 28, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 Revert "jq: fix build with gcc-15"

This reverts commit ec9a5598e48f1e4dad8f59e8a49bfe6657bc2284.

---
 ...c-fix-build-with-Woverlength-strings.patch | 215 ---------------
 ...-add-and-use-LIBM_DA-and-LIBM_DA_NO-.patch | 164 ------------
 ...eck-builtin-cfunctions-in-function_l.patch | 249 ------------------
 meta-oe/recipes-devtools/jq/jq_1.7.1.bb       |   3 -
 4 files changed, 631 deletions(-)
 delete mode 100644 meta-oe/recipes-devtools/jq/jq/0001-builtin.c-fix-build-with-Woverlength-strings.patch
 delete mode 100644 meta-oe/recipes-devtools/jq/jq/0002-libm.h-builtin.c-add-and-use-LIBM_DA-and-LIBM_DA_NO-.patch
 delete mode 100644 meta-oe/recipes-devtools/jq/jq/0003-builtin.c-typecheck-builtin-cfunctions-in-function_l.patch
meta-oe/recipes-devtools/jq/jq/0001-builtin.c-fix-build-with-Woverlength-strings.patch deleted +0 -215
deleted file mode 100644
index cd7cdba00c..0000000000
@@ -1,215 +0,0 @@
-From 8707f8764dfc470d1974eb1d613f5a4bec3610ac Mon Sep 17 00:00:00 2001
-From: Emanuele Torre <[email protected]>
-Date: Fri, 26 Jan 2024 04:42:11 +0100
-Subject: [PATCH] builtin.c: fix build with -Woverlength-strings
-
-C99 only allows string literals long at most 4095 characters.
-jq_builtins was a lot longer than that.
-
-I rewrote all the optional libm error stubs in C so the value of
-jq_builtins is not build dependent.
-
-I replaced the command that generates builtin.inc with a POSIX compliant
-od|sed command that encodes builtin.jq as a comma delimited list of
-octal numbers (that can be embedded in C using a {} literal).
-
-I also added -Woverlength-strings to AM_CFLAGS to verify that the
-problem is fixed.
-
-Fixes #1481
-Upstream-Status: Backport [605836b builtin.c: fix build with -Woverlength-strings]
-Signed-off-by: Martin Jansa <[email protected]>
----
-
- Makefile.am   | 10 ++++--
- src/builtin.c | 86 ++++++++++++++++++++++++---------------------------
- 2 files changed, 48 insertions(+), 48 deletions(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index 76e35df..f1f9f2e 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -19,7 +19,8 @@ LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c    \
- 
- ### C build options
- 
--AM_CFLAGS = -Wextra -Wall -Wno-unused-parameter -Wno-unused-function
-+AM_CFLAGS = -Wextra -Wall -Wno-unused-parameter -Wno-unused-function \
-+            -Woverlength-strings
- 
- if WIN32
- AM_CFLAGS += -municode
-@@ -119,7 +120,12 @@ src/main.c: src/version.h src/config_opts.inc
- 
- src/builtin.inc: $(srcdir)/src/builtin.jq
- 	mkdir -p src
--	$(AM_V_GEN) sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' $(srcdir)/src/builtin.jq > $@
-+	$(AM_V_GEN) od -v -A n -t o1 -- $< | \
-+	sed -e 's/$$/ /' \
-+	    -e 's/\([0123456789]\) /\1, /g' \
-+	    -e 's/ $$//' \
-+	    -e 's/ 0/  0/g' \
-+	    -e 's/ \([123456789]\)/ 0\1/g' > $@
- src/builtin.o: src/builtin.inc
- 
- CLEANFILES = src/version.h .remake-version-h src/builtin.inc src/config_opts.inc
-diff --git a/src/builtin.c b/src/builtin.c
-index 902490d..a3ce7e4 100644
---- a/src/builtin.c
-+++ b/src/builtin.c
-@@ -155,7 +155,11 @@ static jv f_ ## name(jq_state *jq, jv input) { \
-   jv_free(input); \
-   return ret; \
- }
--#define LIBM_DD_NO(name)
-+#define LIBM_DD_NO(name) \
-+static jv f_ ## name(jq_state *jq, jv input) { \
-+  jv error = jv_string("Error: " #name "/0 not found at build time"); \
-+  return ret_error(input, error); \
-+}
- 
- #define LIBM_DDD(name) \
- static jv f_ ## name(jq_state *jq, jv input, jv a, jv b) { \
-@@ -173,7 +177,12 @@ static jv f_ ## name(jq_state *jq, jv input, jv a, jv b) { \
-   jv_free(b); \
-   return ret; \
- }
--#define LIBM_DDD_NO(name)
-+#define LIBM_DDD_NO(name) \
-+static jv f_ ## name(jq_state *jq, jv input, jv a, jv b) { \
-+  jv_free(b); \
-+  jv error = jv_string("Error: " #name "/2 not found at build time"); \
-+  return ret_error2(input, a, error); \
-+}
- 
- #define LIBM_DDDD(name) \
- static jv f_ ## name(jq_state *jq, jv input, jv a, jv b, jv c) { \
-@@ -199,7 +208,14 @@ static jv f_ ## name(jq_state *jq, jv input, jv a, jv b, jv c) { \
-   jv_free(c); \
-   return ret; \
- }
--#define LIBM_DDDD_NO(name)
-+#define LIBM_DDDD_NO(name) \
-+static jv f_ ## name(jq_state *jq, jv input, jv a, jv b, jv c) { \
-+  jv_free(c) \
-+  jv_free(b); \
-+  jv error = jv_string("Error: " #name "/3 not found at build time"); \
-+  return ret_error2(input, a, error); \
-+}
-+
- #include "libm.h"
- #undef LIBM_DDDD_NO
- #undef LIBM_DDD_NO
-@@ -226,6 +242,11 @@ static jv f_frexp(jq_state *jq, jv input) {
-   jv_free(input);
-   return ret;
- }
-+#else
-+static jv f_frexp(jq_state *jq, jv input) {
-+  jv error = jv_string("Error: frexp/0 not found at build time");
-+  return ret_error(input, error);
-+}
- #endif
- #ifdef HAVE_MODF
- static jv f_modf(jq_state *jq, jv input) {
-@@ -237,6 +258,11 @@ static jv f_modf(jq_state *jq, jv input) {
-   jv_free(input);
-   return jv_array_append(ret, jv_number(i));
- }
-+#else
-+static jv f_modf(jq_state *jq, jv input) {
-+  jv error = jv_string("Error: modf/0 not found at build time");
-+  return ret_error(input, error);
-+}
- #endif
- #ifdef HAVE_LGAMMA_R
- static jv f_lgamma_r(jq_state *jq, jv input) {
-@@ -248,6 +274,11 @@ static jv f_lgamma_r(jq_state *jq, jv input) {
-   jv_free(input);
-   return jv_array_append(ret, jv_number(sign));
- }
-+#else
-+static jv f_lgamma_r(jq_state *jq, jv input) {
-+  jv error = jv_string("Error: lgamma_r/0 not found at build time");
-+  return ret_error(input, error);
-+}
- #endif
- 
- static jv f_negate(jq_state *jq, jv input) {
-@@ -1703,27 +1734,21 @@ static jv f_current_line(jq_state *jq, jv a) {
- 
- #define LIBM_DD(name) \
-   {f_ ## name,  #name, 1},
--#define LIBM_DD_NO(name)
-+#define LIBM_DD_NO(name) LIBM_DD(name)
- 
- #define LIBM_DDD(name) \
-   {f_ ## name, #name, 3},
--#define LIBM_DDD_NO(name)
-+#define LIBM_DDD_NO(name) LIBM_DDD(name)
- 
- #define LIBM_DDDD(name) \
-   {f_ ## name, #name, 4},
--#define LIBM_DDDD_NO(name)
-+#define LIBM_DDDD_NO(name) LIBM_DDDD(name)
- 
- static const struct cfunction function_list[] = {
- #include "libm.h"
--#ifdef HAVE_FREXP
-   {f_frexp,"frexp", 1},
--#endif
--#ifdef HAVE_MODF
-   {f_modf,"modf", 1},
--#endif
--#ifdef HAVE_LGAMMA_R
-   {f_lgamma_r,"lgamma_r", 1},
--#endif
-   {f_negate, "_negate", 1},
- #define BINOP(name) {f_ ## name, "_" #name, 3},
- BINOPS
-@@ -1838,42 +1863,11 @@ static block bind_bytecoded_builtins(block b) {
-   return BLOCK(builtins, b);
- }
- 
--static const char jq_builtins[] =
-+static const char jq_builtins[] = {
- /* Include jq-coded builtins */
- #include "src/builtin.inc"
--
--/* Include unsupported math functions next */
--#define LIBM_DD(name)
--#define LIBM_DDD(name)
--#define LIBM_DDDD(name)
--#define LIBM_DD_NO(name) "def " #name ": \"Error: " #name "/0 not found at build time\"|error;"
--#define LIBM_DDD_NO(name) "def " #name "(a;b): \"Error: " #name "/2 not found at build time\"|error;"
--#define LIBM_DDDD_NO(name) "def " #name "(a;b;c): \"Error: " #name "/3 not found at build time\"|error;"
--#include "libm.h"
--#ifndef HAVE_FREXP
--  "def frexp: \"Error: frexp/0 not found at build time\"|error;"
--#endif
--#ifndef HAVE_MODF
--  "def modf: \"Error: modf/0 not found at build time\"|error;"
--#endif
--#ifndef HAVE_LGAMMA_R
--  "def lgamma_r: \"Error: lgamma_r/0 not found at build time\"|error;"
--#endif
--;
--
--#undef LIBM_DDDD_NO
--#undef LIBM_DDD_NO
--#undef LIBM_DD_NO
--#undef LIBM_DDDD
--#undef LIBM_DDD
--#undef LIBM_DD
--
--#ifdef __APPLE__
--#undef HAVE_GAMMA
--#undef HAVE_EXP10
--#undef HAVE_DREM
--#undef HAVE_SIGNIFICAND
--#endif
-+  '\0',
-+};
- 
- static block gen_builtin_list(block builtins) {
-   jv list = jv_array_append(block_list_funcs(builtins, 1), jv_string("builtins/0"));
meta-oe/recipes-devtools/jq/jq/0002-libm.h-builtin.c-add-and-use-LIBM_DA-and-LIBM_DA_NO-.patch deleted +0 -164

164 lines not on this page · raw message

meta-oe/recipes-devtools/jq/jq/0003-builtin.c-typecheck-builtin-cfunctions-in-function_l.patch deleted +0 -249

249 lines not on this page · raw message

meta-oe/recipes-devtools/jq/jq_1.7.1.bb +0 -3
index 3f57adb910..6b12335513 100644
@@ -10,9 +10,6 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=488f4e0b04c0456337fb70d1ac1758ba"
 
 GITHUB_BASE_URI = "https://github.com/jqlang/${BPN}/releases/"
 SRC_URI = "${GITHUB_BASE_URI}/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \
-    file://0001-builtin.c-fix-build-with-Woverlength-strings.patch \
-    file://0002-libm.h-builtin.c-add-and-use-LIBM_DA-and-LIBM_DA_NO-.patch \
-    file://0003-builtin.c-typecheck-builtin-cfunctions-in-function_l.patch \
     file://run-ptest \
     "
 SRC_URI[sha256sum] = "478c9ca129fd2e3443fe27314b455e211e0d8c60bc8ff7df703873deeee580c2"
author
#1 lore raw

PATCH 2/2 jq: Stick to C17 until next release

Patches are sprinkled in master branch of jq but the backports regresses tests, so its better to keep it at C17 for now.

Cc Martin Jansa <[email protected]>
---
 meta-oe/recipes-devtools/jq/jq_1.7.1.bb | 3 +++
 1 file changed, 3 insertions(+)
meta-oe/recipes-devtools/jq/jq_1.7.1.bb +3 -0
index 6b12335513..a6a1d6a07a 100644
@@ -26,6 +26,9 @@ PACKAGECONFIG[oniguruma] = "--with-oniguruma,--without-oniguruma,onig"
 # enable if you want ptest running under valgrind
 PACKAGECONFIG[valgrind] = "--enable-valgrind,--disable-valgrind,valgrind"
 
+# Gets going with gcc-15 but See if it can be removed with next upgrade
+CFLAGS += "-std=gnu17"
+
 do_configure:append() {
 	sed -i -e "/^ac_cs_config=/ s:${WORKDIR}::g" ${B}/config.status
 }
Acked-by on v1 1/2
#2 lore raw
In reply to Khem Raj
Quoted 7 lines · Khem Raj via lists.openembedded.org

This reverts commit ec9a5598e48f1e4dad8f59e8a49bfe6657bc2284.

---
 ...c-fix-build-with-Woverlength-strings.patch | 215 ---------------
 ...-add-and-use-LIBM_DA-and-LIBM_DA_NO-.patch | 164 ------------
 ...eck-builtin-cfunctions-in-function_l.patch | 249 ------------------
 meta-oe/recipes-devtools/jq/jq_1.7.1.bb       |   3 -

I'm fine with CFLAGS += "-std=gnu17", it was just one of failures shown in world build gcc-15 and it's not included in any of our images. Thank you and I'm sorry for not catching ptest issue earlier.

Cheers,