Skip to contentSkip to conversation

flex: Keep it at C17 with clang

PATCH New Khem Raj 1 participant 1 message Apr 9

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 flex: Keep it at C17 with clang

autoconf 2.73 enforces C23 and adds -std=gnu23 but it leaks it into CC_FOR_BUILD as well, which bites on systems with GCC < 14 where this option does not exist.

---
 meta/recipes-devtools/flex/flex_2.6.4.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-devtools/flex/flex_2.6.4.bb +5 -0
index fa8c0fb6fd..0507d4e300 100644
@@ -36,6 +36,11 @@ inherit autotools gettext texinfo ptest github-releases
 M4 = "${bindir}/m4"
 M4:class-native = "${STAGING_BINDIR_NATIVE}/m4"
 EXTRA_OECONF += "ac_cv_path_M4=${M4} ac_cv_func_reallocarray=no"
+# Don't let autoconf smarts to detect C standard, flex code does not need C23
+# which is what it will enforce see
+# https://savannah.gnu.org/support/index.php?111401
+CACHED_CONFIGUREVARS:append:toolchain-clang = " CFLAGS='${CFLAGS} -std=gnu17'"
+
 EXTRA_OEMAKE += "m4=${STAGING_BINDIR_NATIVE}/m4"
 
 EXTRA_OEMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', 'FLEX=${STAGING_BINDIR_NATIVE}/flex', '', d)}"