[hackers] [scc] [cpp] provide a way to configure sys include paths || Quentin Rameau
commit feaa80c03c85e2732b0fe3e3672f9a541cc4bd4f
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Tue Jan 24 17:39:51 2017 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Tue Jan 24 18:34:57 2017 +0100
[cpp] provide a way to configure sys include paths
This fixes too scc internal per-architecture standard include files.
diff --git a/Makefile b/Makefile
index 0d82783..1b39f78 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -64,3 +64,4 @@ clean:
distclean: clean
rm -rf bin
+ rm -f inc/sysincludes.h
diff --git a/cc1/Makefile b/cc1/Makefile
index 1aca22d..b9f73ce 100644
--- a/cc1/Makefile
+++ b/cc1/Makefile
_AT_@ -11,8 +11,12 @@ OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \
all: cc1-$(ARCH)
cpp.o: stallman.msg
+arch/$(ARCH)/arch.o: ../inc/sysincludes.h
$(OBJS): cc1.h ../inc/cc.h ../inc/$(STD)/cstd.h
+../inc/sysincludes.h:
+ cp -f ../inc/sysincludes.def.h ../inc/sysincludes.h
+
../lib/libcc.a:
cd ../lib && $(MAKE) -e
diff --git a/cc1/arch/amd64-sysv/arch.c b/cc1/arch/amd64-sysv/arch.c
index f0393bb..f4492b4 100644
--- a/cc1/arch/amd64-sysv/arch.c
+++ b/cc1/arch/amd64-sysv/arch.c
_AT_@ -2,6 +2,7 @@
static char sccsid[] = "_AT_(#) ./cc1/arch/amd64-sysv/arch.c";
#include <stdio.h>
+#include "../../../inc/sysincludes.h"
#include "../../../inc/cc.h"
#include "../../cc1.h"
diff --git a/cc1/arch/i386-sysv/arch.c b/cc1/arch/i386-sysv/arch.c
index 2a8ab3a..f72f889 100644
--- a/cc1/arch/i386-sysv/arch.c
+++ b/cc1/arch/i386-sysv/arch.c
_AT_@ -1,6 +1,8 @@
/* See LICENSE file for copyright and license details. */
static char sccsid[] = "_AT_(#) ./cc1/arch/i386-sysv/arch.c";
#include <stdio.h>
+
+#include "../../../inc/sysincludes.h"
#include "../../../inc/cc.h"
#include "../../cc1.h"
diff --git a/cc1/arch/qbe/arch.c b/cc1/arch/qbe/arch.c
index d339ba7..233a390 100644
--- a/cc1/arch/qbe/arch.c
+++ b/cc1/arch/qbe/arch.c
_AT_@ -2,6 +2,7 @@
static char sccsid[] = "_AT_(#) ./cc1/arch/qbe/arch.c";
#include <stdio.h>
+#include "../../../inc/sysincludes.h"
#include "../../../inc/cc.h"
#include "../../cc1.h"
diff --git a/cc1/arch/z80/arch.c b/cc1/arch/z80/arch.c
index 55c53dc..0c603f6 100644
--- a/cc1/arch/z80/arch.c
+++ b/cc1/arch/z80/arch.c
_AT_@ -2,6 +2,7 @@
static char sccsid[] = "_AT_(#) ./cc1/arch/z80/arch.c";
#include <stdio.h>
+#include "../../../inc/sysincludes.h"
#include "../../../inc/cc.h"
#include "../../cc1.h"
diff --git a/cc1/cpp.c b/cc1/cpp.c
index 44c8dd6..2fa22ed 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -11,6 +11,7 @@ static char sccsid[] = "@(#) ./cc1/cpp.c";
#include "../inc/cc.h"
#include "cc1.h"
+extern char *sysincludes[];
static char *argp, *macroname;
static unsigned arglen;
static unsigned ncmdlines;
_AT_@ -464,12 +465,6 @@ include(void)
{
char dir[FILENAME_MAX], file[FILENAME_MAX], *p, **bp;
size_t filelen;
- static char *sysinclude[] = {
- PREFIX "/include/scc/" ARCH "/",
- PREFIX "/include/",
- PREFIX "/local/include/",
- NULL
- };
int n;
if (cppoff)
_AT_@ -517,7 +512,7 @@ include(void)
if (includefile(*bp, file, filelen))
goto its_done;
}
- for (bp = sysinclude; *bp; ++bp) {
+ for (bp = sysincludes; *bp; ++bp) {
if (includefile(*bp, file, filelen))
goto its_done;
}
diff --git a/inc/sysincludes.def.h b/inc/sysincludes.def.h
new file mode 100644
index 0000000..dba9e7e
--- /dev/null
+++ b/inc/sysincludes.def.h
_AT_@ -0,0 +1,7 @@
+char *sysincludes[] = {
+ PREFIX "/include/scc/" ARCH "/",
+ /* configure below your standard sys include paths */
+ PREFIX "/include/",
+ PREFIX "/local/include/",
+ NULL
+};
Received on Tue Jan 24 2017 - 18:49:19 CET
This archive was generated by hypermail 2.3.0
: Tue Jan 24 2017 - 19:00:20 CET