1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
From 47a2305433ea6b123ef6baf65f496b4583e198da Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Mon, 21 Sep 2026 13:00:09 +0100
Subject: [PATCH 53/56] use -std=gnu2x
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
equiv to gnu23 in practise, and fixes a build error
for a user who reported:
cc: error: unrecognized command-line option ‘-std=gnu23’; did you mean ‘-std=gnu2x’?
when building coreboot utils
gnu2x is gnu23 in practise, on both gcc and clang.
we can just use this, and it won't break systems
that worked.
the user did not say what compiler and compiler version
they were using (cbutils are built using hostcc in lbmk)
Signed-off-by: Leah Rowe <leah@libreboot.org>
---
Makefile.mk | 2 +-
payloads/libpayload/Makefile | 2 +-
tests/Makefile.common | 2 +-
util/amdfwtool/Makefile.mk | 2 +-
util/cbfstool/Makefile.mk | 2 +-
util/cbmem/Makefile | 2 +-
util/ifdtool/Makefile.mk | 2 +-
util/sconfig/Makefile.mk | 2 +-
util/supermicro/Makefile.mk | 2 +-
13 files changed, 599 insertions(+), 9 deletions(-)
diff --git a/Makefile.mk b/Makefile.mk
index 2c39d3d632..12e2368a8f 100644
--- a/Makefile.mk
+++ b/Makefile.mk
@@ -530,7 +530,7 @@ endif
CFLAGS_common += -pipe
CFLAGS_common += -g
CFLAGS_common += -nostdinc
-CFLAGS_common += -std=gnu23
+CFLAGS_common += -std=gnu2x
CFLAGS_common += -nostdlib
CFLAGS_common += -Wall
CFLAGS_common += -Wundef
diff --git a/payloads/libpayload/Makefile b/payloads/libpayload/Makefile
index 29c3fb199f..bb7c6f600f 100644
--- a/payloads/libpayload/Makefile
+++ b/payloads/libpayload/Makefile
@@ -218,7 +218,7 @@ STRIP := $(STRIP_$(ARCH-y))
AR := $(AR_$(ARCH-y))
endif
-CFLAGS += -std=gnu23 $(CFLAGS_$(ARCH-y))
+CFLAGS += -std=gnu2x $(CFLAGS_$(ARCH-y))
ifeq ($(CONFIG_LP_COMPILER_LLVM_CLANG),y)
CC:=clang
diff --git a/tests/Makefile.common b/tests/Makefile.common
index c35e312a79..5c6f8ff798 100644
--- a/tests/Makefile.common
+++ b/tests/Makefile.common
@@ -51,7 +51,7 @@ TEST_CFLAGS += -Wno-unknown-warning-option -Wno-source-mgr -Wno-main-return-type
TEST_CFLAGS += -Wno-array-compare -Wno-trigraphs
TEST_CFLAGS += -Wno-unused-but-set-variables
-TEST_CFLAGS += -std=gnu23 -ffunction-sections -fdata-sections -fno-builtin
+TEST_CFLAGS += -std=gnu2x -ffunction-sections -fdata-sections -fno-builtin
ifneq ($(filter-out 0,$(DEBUG)),)
TEST_CFLAGS += -Og -ggdb3
diff --git a/util/amdfwtool/Makefile.mk b/util/amdfwtool/Makefile.mk
index f7dce01b71..ac09d083cf 100644
--- a/util/amdfwtool/Makefile.mk
+++ b/util/amdfwtool/Makefile.mk
@@ -11,7 +11,7 @@ AMDFWTOOLCFLAGS :=-O2 -Wall -Wextra -Wshadow $(WERROR)
AMDFWTOOLCFLAGS += -I $(top)/src/commonlib/bsd/include
AMDFWTOOLCFLAGS += -I $(top)/src/
AMDFWTOOLCFLAGS += -D_GNU_SOURCE # memmem() from string.h
-AMDFWTOOLCFLAGS += -std=gnu23
+AMDFWTOOLCFLAGS += -std=gnu2x
AMDFWTOOLCFLAGS += -ffunction-sections -fdata-sections
ifneq ($(PKG_CONFIG),)
diff --git a/util/cbfstool/Makefile.mk b/util/cbfstool/Makefile.mk
index d195e4713a..75e8f1797f 100644
--- a/util/cbfstool/Makefile.mk
+++ b/util/cbfstool/Makefile.mk
@@ -175,7 +175,7 @@ HOSTCFLAGS += -fms-extensions
TOOLCFLAGS += -mno-ms-bitfields
endif
ifeq ($(shell uname -o 2>/dev/null), Cygwin)
-TOOLCFLAGS+=-std=gnu23
+TOOLCFLAGS+=-std=gnu2x
TOOLCPPFLAGS+=-D_GNU_SOURCE
else
TOOLCFLAGS+=-std=c11
diff --git a/util/cbmem/Makefile b/util/cbmem/Makefile
index fe2891be6d..bb305cee77 100644
--- a/util/cbmem/Makefile
+++ b/util/cbmem/Makefile
@@ -11,7 +11,7 @@ PREFIX ?= /usr/local
CFLAGS ?= -O2
WERROR=
CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wshadow $(WERROR)
-CFLAGS += -std=gnu23
+CFLAGS += -std=gnu2x
CPPFLAGS += -I . -I $(ROOT)/commonlib/include -I $(ROOT)/commonlib/bsd/include
CPPFLAGS += -include $(ROOT)/commonlib/bsd/include/commonlib/bsd/compiler.h
diff --git a/util/ifdtool/Makefile.mk b/util/ifdtool/Makefile.mk
index 57d192ccb8..58bec4739c 100644
--- a/util/ifdtool/Makefile.mk
+++ b/util/ifdtool/Makefile.mk
@@ -7,7 +7,7 @@ IFDTOOLCFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/inclu
IFDTOOLCFLAGS += -I$(top)/util/cbfstool/flashmap
IFDTOOLCFLAGS += -include $(top)/src/commonlib/bsd/include/commonlib/bsd/compiler.h
IFDTOOLCFLAGS += -D_DEFAULT_SOURCE # for endianness converting functions
-IFDTOOLCFLAGS += -std=gnu23
+IFDTOOLCFLAGS += -std=gnu2x
$(objutil)/ifdtool/%.o: $(top)/util/ifdtool/%.c
$(HOSTCC) $(IFDTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
diff --git a/util/sconfig/Makefile.mk b/util/sconfig/Makefile.mk
index 9dcf5b5c71..cda1d81223 100644
--- a/util/sconfig/Makefile.mk
+++ b/util/sconfig/Makefile.mk
@@ -6,7 +6,7 @@ sconfigobj += main.o
SCONFIGFLAGS += -I$(top)/util/sconfig -I$(objutil)/sconfig
SCONFIGFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/include
-SCONFIGFLAGS += -std=gnu23
+SCONFIGFLAGS += -std=gnu2x
$(objutil)/sconfig:
mkdir -p $@
diff --git a/util/supermicro/Makefile.mk b/util/supermicro/Makefile.mk
index f627b854bd..f5e0d7012c 100644
--- a/util/supermicro/Makefile.mk
+++ b/util/supermicro/Makefile.mk
@@ -6,7 +6,7 @@ SMCBIOSINFOTOOL:= $(objutil)/supermicro/smcbiosinfo
$(SMCBIOSINFOTOOL): $(dir)/smcbiosinfo/smcbiosinfo.c
printf " HOSTCC Creating SMCBIOSINFO tool\n"
mkdir -p $(objutil)/supermicro
- $(HOSTCC) -std=gnu23 $(TOOLCPPFLAGS) $< -o $@
+ $(HOSTCC) -std=gnu2x $(TOOLCPPFLAGS) $< -o $@
ifeq ($(CONFIG_VENDOR_SUPERMICRO),y)
ifneq ($(call strip_quotes, $(CONFIG_SUPERMICRO_BOARDID)),)
--
2.47.3
|