driver/posix: Add a __QBE__ macro - scc - simple c99 compiler
HTML git clone git://git.simple-cc.org/scc
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 3103a4ad89edc64ed22bd66de2a49b15a7e43d1b
DIR parent 4aff072f0bc195635c23adeccf0f436df02ac890
HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 1 Apr 2026 08:27:21 +0200
driver/posix: Add a __QBE__ macro
There are several constructions that cannot be done using qbe, like
for example volatile variables, and in order to have some of the libc
tests with qbe we needed a way to adapt them for this situation.
Diffstat:
M src/cmd/scc-cc/posix/cc.c | 5 ++++-
M tests/libc/execute/0008-longjmp.c | 5 +++++
2 files changed, 9 insertions(+), 1 deletion(-)
---
DIR diff --git a/src/cmd/scc-cc/posix/cc.c b/src/cmd/scc-cc/posix/cc.c
@@ -68,7 +68,7 @@ static struct items objtmp, objout;
static struct items linkargs, cc1args;
static int Mflag, Eflag, Sflag, Wflag,
- cflag, dflag, kflag, sflag, Qflag = 1, /* TODO: Remove Qflag */
+ cflag, dflag, kflag, sflag, Qflag = 1,
gflag;
static int devnullfd = -1;
@@ -222,6 +222,9 @@ settool(int tool, char *infile, int nexttool)
addarg(tool, "-M");
if (Wflag)
addarg(tool, "-w");
+ if (Qflag)
+ addarg(tool, "-D__QBE__");
+
for (n = 0; n < cc1args.n; ++n)
addarg(tool, cc1args.s[n]);
for (n = 0; sysincludes[n]; ++n) {
DIR diff --git a/tests/libc/execute/0008-longjmp.c b/tests/libc/execute/0008-longjmp.c
@@ -23,7 +23,12 @@ int
main()
{
static int i;
+#ifdef __QBE__
+ // We cannot implement proper volatile with qbe
+ static volatile int v;
+#else
auto volatile int v;
+#endif
i = 0;
v = 1;