scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 260b630dfbacb67174712d947be23c491ba1fc82
parent 10947d3cb94d2873d6c7959301461e12a20f1a87
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 15 Sep 2021 06:49:59 +0200

build: Add fixes for NetBSD

NetBSD needs the same hack for ARFLAGS that OpenBSD.
Ideally we should submit a patch for NetBSD to solve
this issue because it has a good support for .POSIX.

This patch also adds a temporary hack to solve a
problem in NetBSD when POSIX_C_SOURCE and _ANSI_SOURCE
are defined at the same time. A patch was submited to
NetBSD and this hack is expected to be removed in a
future.

Diffstat:
Mscripts/config | 4++++
Msrc/cmd/cc/posix/cc.c | 13++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/scripts/config b/scripts/config @@ -4,6 +4,10 @@ case `uname` in OpenBSD) echo TOOL=${TOOL:-clang} HOST=bsd ARFLAGS=${ARFLAGS:--rv} ;; +NetBSD) + #TODO: send a patch to NetBSD to solve this problem + echo HOST=bsd ARFLAGS=${ARFLAGS:--rv} + ;; *BSD) echo HOST=bsd ;; diff --git a/src/cmd/cc/posix/cc.c b/src/cmd/cc/posix/cc.c @@ -1,4 +1,15 @@ -#define _POSIX_SOURCE 200809L +/* + * FIXME: scc is a pure C99 source code, except this file that is + * intended for a POSIX.2008 environment. This situation creates + * a problem where some systems require the macro _ANSI_SOURCE to + * limit the namespace to a pure ISO namespace. NetBSD has a bug + * and using POSIX_C_SOURCE and _ANSI_SOURCE at the same time + * generates a syntax error in the system headers. A patch was + * sent to NetBSD, but this temporary fix is added here until the + * patch arrives to the stable release. + */ +#define _POSIX_C_SOURCE 200809L +#undef _ANSI_SOURCE #include <sys/types.h> #include <sys/wait.h>