unifdef: Don't use C23 constexpr keyword

Fixes build with GCC-15

(From OE-Core rev: 3085783dd5585a85a3853858215689c362429c64)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
Khem Raj
2025-08-22 00:43:00 +02:00
committed by Steve Sakoman
parent 2a0bd475e8
commit 6b639e1975
2 changed files with 59 additions and 1 deletions

View File

@@ -0,0 +1,57 @@
From ca1ac9c8bde84dbdea972299b1a6e30e78c2d785 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sun, 17 Nov 2024 01:26:27 +0000
Subject: [PATCH] Don't use C23 constexpr keyword
This fixes building with upcoming GCC 15 which defaults to -std=gnu23.
Upstream-Status: Submitted [https://github.com/fanf2/unifdef/pull/19]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
unifdef.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/unifdef.c b/unifdef.c
index dc145a2..4bd3bda 100644
--- a/unifdef.c
+++ b/unifdef.c
@@ -202,7 +202,7 @@ static int depth; /* current #if nesting */
static int delcount; /* count of deleted lines */
static unsigned blankcount; /* count of blank lines */
static unsigned blankmax; /* maximum recent blankcount */
-static bool constexpr; /* constant #if expression */
+static bool is_constexpr; /* constant #if expression */
static bool zerosyms; /* to format symdepth output */
static bool firstsym; /* ditto */
@@ -1086,7 +1086,7 @@ eval_unary(const struct ops *ops, long *valp, const char **cpp)
*valp = (value[sym] != NULL);
lt = *valp ? LT_TRUE : LT_FALSE;
}
- constexpr = false;
+ is_constexpr = false;
} else if (!endsym(*cp)) {
debug("eval%d symbol", prec(ops));
sym = findsym(&cp);
@@ -1103,7 +1103,7 @@ eval_unary(const struct ops *ops, long *valp, const char **cpp)
lt = *valp ? LT_TRUE : LT_FALSE;
cp = skipargs(cp);
}
- constexpr = false;
+ is_constexpr = false;
} else {
debug("eval%d bad expr", prec(ops));
return (LT_ERROR);
@@ -1170,10 +1170,10 @@ ifeval(const char **cpp)
long val = 0;
debug("eval %s", *cpp);
- constexpr = killconsts ? false : true;
+ is_constexpr = killconsts ? false : true;
ret = eval_table(eval_ops, &val, cpp);
debug("eval = %d", val);
- return (constexpr ? LT_IF : ret == LT_ERROR ? LT_IF : ret);
+ return (is_constexpr ? LT_IF : ret == LT_ERROR ? LT_IF : ret);
}
/*

View File

@@ -8,7 +8,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=3498caf346f6b77934882101749ada23 \
file://unifdef.c;endline=32;md5=6f4ee8085d6e6ab0f7cb4390e1a9c497 \
"
SRC_URI = "http://dotat.at/prog/${BPN}/${BP}.tar.xz"
SRC_URI = "http://dotat.at/prog/${BPN}/${BP}.tar.xz \
file://0001-Don-t-use-C23-constexpr-keyword.patch"
SRC_URI[md5sum] = "ae8c0b3b4c43c1f6bc5f32412a820818"
SRC_URI[sha256sum] = "43ce0f02ecdcdc723b2475575563ddb192e988c886d368260bc0a63aee3ac400"