Skip to content

Commit b4a2142

Browse files
authored
yasm: patch for C23 compliance (spack#1963)
* Add patch for C23 compliance in yasm package Added a patch to ensure C23 compliance in boolean enum. * yasm: add local patch * yasm: add link to upstream PR
1 parent 178e20d commit b4a2142

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 64ef740eb262f329e55eebadf2ce276b146d44e9 Mon Sep 17 00:00:00 2001
2+
From: Martin Jansa <[email protected]>
3+
Date: Tue, 22 Apr 2025 19:06:24 +0200
4+
Subject: [PATCH] bitvect: fix build with gcc-15
5+
6+
* fixes:
7+
libyasm/bitvect.h:86:32: error: cannot use keyword 'false' as enumeration constant
8+
86 | typedef enum boolean { false = FALSE, true = TRUE } boolean;
9+
| ^~~~~
10+
../git/libyasm/bitvect.h:86:32: note: 'false' is a keyword with '-std=c23' onwards
11+
12+
as suggested in:
13+
https://github.com/yasm/yasm/issues/283#issuecomment-2661108816
14+
15+
Signed-off-by: Martin Jansa <[email protected]>
16+
---
17+
libyasm/bitvect.h | 6 +++++-
18+
1 file changed, 5 insertions(+), 1 deletion(-)
19+
20+
diff --git a/libyasm/bitvect.h b/libyasm/bitvect.h
21+
index 3aee3a531..a13470ada 100644
22+
--- a/libyasm/bitvect.h
23+
+++ b/libyasm/bitvect.h
24+
@@ -83,7 +83,11 @@ typedef Z_longword *Z_longwordptr;
25+
#ifdef MACOS_TRADITIONAL
26+
#define boolean Boolean
27+
#else
28+
- typedef enum boolean { false = FALSE, true = TRUE } boolean;
29+
+ #if __STDC_VERSION__ < 202311L
30+
+ typedef enum boolean { false = FALSE, true = TRUE } boolean;
31+
+ #else
32+
+ typedef bool boolean;
33+
+ #endif
34+
#endif
35+
#endif
36+

repos/spack_repo/builtin/packages/yasm/package.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ class Yasm(AutotoolsPackage):
2222
version("develop", branch="master")
2323
version("1.3.0", sha256="3dce6601b495f5b3d45b59f7d2492a340ee7e84b5beca17e48f862502bd5603f")
2424

25+
# Ensure C23 compliance in boolean enum
26+
# https://github.com/yasm/yasm/pull/287
27+
patch("libyasm_bitvect_c23_bool.patch")
28+
2529
depends_on("c", type="build") # generated
2630

2731
depends_on("autoconf", when="@develop")

0 commit comments

Comments
 (0)