[hackers] [scc] Makefile: add support for DESTDIR installation || Quentin Rameau
commit cd5cd2e925f70f972480a80b5a208056ef19cad4 Author: Quentin Rameau AuthorDate: Tue Jan 24 14:37:01 2017 +0100 Commit: Quentin Rameau CommitDate: Tue Jan 24 14:37:01 2017 +0100 Makefile: add support for DESTDIR installation diff --git a/Makefile b/Makefile index 225c505..7aaabaa 100644 --- a/Makefile +++ b/Makefile @@ -32,21 +32,21 @@ tests: all cd tests/execute && $(MAKE) -e tests install: all - mkdir -p $(PREFIX)/libexec/scc/ - mkdir -p $(PREFIX)/bin/ - mkdir -p $(PREFIX)/include/scc - cp -f bin/cc?-* $(PREFIX)/libexec/scc/ - cp -f bin/cc1-$(ARCH) $(PREFIX)/bin/cpp - cp -f bin/scc $(PREFIX)/bin/ - cp -fr libc/include/* $(PREFIX)/include/scc/ - find $(PREFIX)/include/scc/ -type f | xargs chmod 644 - cd $(PREFIX)/libexec/scc/ && chmod 755 cc* && strip cc* - cd $(PREFIX)/bin && chmod 755 cpp scc && strip cpp scc + mkdir -p $(DESTDIR)/$(PREFIX)/libexec/scc/ + mkdir -p $(DESTDIR)/$(PREFIX)/bin/ + mkdir -p $(DESTDIR)/$(PREFIX)/include/scc + cp -f bin/cc?-* $(DESTDIR)/$(PREFIX)/libexec/scc/ + cp -f bin/cc1-$(ARCH) $(DESTDIR)/$(PREFIX)/bin/cpp + cp -f bin/scc $(DESTDIR)/$(PREFIX)/bin/ + cp -fr libc/include/* $(DESTDIR)/$(PREFIX)/include/scc/ + find $(DESTDIR)/$(PREFIX)/include/scc/ -type f | xargs chmod 644 + cd $(DESTDIR)/$(PREFIX)/libexec/scc/ && chmod 755 cc* && strip cc* + cd $(DESTDIR)/$(PREFIX)/bin && chmod 755 cpp scc && strip cpp scc uninstall: - rm -rf $(PREFIX)/libexec/scc/ - rm -f $(PREFIX)/bin/scc - rm -f $(PREFIX)/bin/cpp + rm -rf $(DESTDIR)/$(PREFIX)/libexec/scc/ + rm -f $(DESTDIR)/$(PREFIX)/bin/scc + rm -f $(DESTDIR)/$(PREFIX)/bin/cpp clean-helper: for i in $(DIRS); \
[hackers] [scc] Makefile: uninstall include directory too || Quentin Rameau
commit 70500f1e134d44e3ca341a15f66447a8465346b0 Author: Quentin Rameau AuthorDate: Tue Jan 24 14:39:04 2017 +0100 Commit: Quentin Rameau CommitDate: Tue Jan 24 14:39:04 2017 +0100 Makefile: uninstall include directory too diff --git a/Makefile b/Makefile index 7aaabaa..0d82783 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ tests: all install: all mkdir -p $(DESTDIR)/$(PREFIX)/libexec/scc/ mkdir -p $(DESTDIR)/$(PREFIX)/bin/ - mkdir -p $(DESTDIR)/$(PREFIX)/include/scc + mkdir -p $(DESTDIR)/$(PREFIX)/include/scc/ cp -f bin/cc?-* $(DESTDIR)/$(PREFIX)/libexec/scc/ cp -f bin/cc1-$(ARCH) $(DESTDIR)/$(PREFIX)/bin/cpp cp -f bin/scc $(DESTDIR)/$(PREFIX)/bin/ @@ -44,6 +44,7 @@ install: all cd $(DESTDIR)/$(PREFIX)/bin && chmod 755 cpp scc && strip cpp scc uninstall: + rm -rf $(DESTDIR)/$(PREFIX)/include/scc/ rm -rf $(DESTDIR)/$(PREFIX)/libexec/scc/ rm -f $(DESTDIR)/$(PREFIX)/bin/scc rm -f $(DESTDIR)/$(PREFIX)/bin/cpp
[hackers] [scc] Makefile: add a tests target || Quentin Rameau
commit 396acbfb178cf1d4b38a84eafc56ed7234fb189c Author: Quentin Rameau AuthorDate: Tue Jan 24 14:28:29 2017 +0100 Commit: Quentin Rameau CommitDate: Tue Jan 24 14:28:29 2017 +0100 Makefile: add a tests target diff --git a/Makefile b/Makefile index a755a69..225c505 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,9 @@ $(ARCHS): bin bin: mkdir -p bin +tests: all + cd tests/execute && $(MAKE) -e tests + install: all mkdir -p $(PREFIX)/libexec/scc/ mkdir -p $(PREFIX)/bin/
[hackers] [scc] [cc2-qbe] Check void type out of int and floats || Roberto E. Vargas Caballero
commit 1685a71d45fc658f1a9793d78440ac85b79d60d0 Author: Roberto E. Vargas Caballero AuthorDate: Tue Jan 24 16:28:33 2017 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Tue Jan 24 16:28:33 2017 +0100 [cc2-qbe] Check void type out of int and floats Voidtype hasn't any of the flags INTF or FLOATF, so it was generating an abort() diff --git a/cc2/arch/qbe/code.c b/cc2/arch/qbe/code.c index bca8020..8e2c0a9 100644 --- a/cc2/arch/qbe/code.c +++ b/cc2/arch/qbe/code.c @@ -310,7 +310,6 @@ size2stack(Type *tp) { if (tp->flags & INTF) { switch (tp->size) { - case 0: case 1: case 2: case 4: @@ -323,6 +322,8 @@ size2stack(Type *tp) return "s"; else if (tp->size == 8) return "d"; + } else if (tp->size == 0) { + return "w"; } abort(); }
[hackers] [scc] [libc] Fix sizes in z80/stdint.h || Roberto E. Vargas Caballero
commit 2541dce5d67d302749487259f2feb36fd0f27f40 Author: Roberto E. Vargas Caballero AuthorDate: Tue Jan 24 16:49:38 2017 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Tue Jan 24 16:49:38 2017 +0100 [libc] Fix sizes in z80/stdint.h diff --git a/libc/include/z80/stdint.h b/libc/include/z80/stdint.h index b6521b1..5a9f266 100644 --- a/libc/include/z80/stdint.h +++ b/libc/include/z80/stdint.h @@ -27,15 +27,15 @@ typedef int int16_fast_t; typedef long int32_fast_t; typedef long long int64_fast_t; -typedef unsigned char int8_fast_t; -typedef unsigned int16_fast_t; -typedef unsigned long int32_fast_t; -typedef unsigned long long int64_fast_t; +typedef unsigned char uint8_fast_t; +typedef unsigned uint16_fast_t; +typedef unsigned long uint32_fast_t; +typedef unsigned long long uint64_fast_t; -typedef intptr_t long; -typedef uintptr_t unsigned; +typedef long intptr_t; +typedef unsigned uintptr_t; -typedef intmax_t long; -typedef long long uintmax_t unsigned; +typedef long long intmax_t; +typedef unsigned long long uintmax_t; #endif
[hackers] [scc] [tests] Use stdint.h in 0107-bnot.c || Roberto E. Vargas Caballero
commit 46372e9a0d5cbac26feb3890f0539c6d7d327f71 Author: Roberto E. Vargas Caballero AuthorDate: Tue Jan 24 17:06:05 2017 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Tue Jan 24 17:06:05 2017 +0100 [tests] Use stdint.h in 0107-bnot.c This test was assuming several sizes in the integer types which is totall wrong for a test. diff --git a/tests/execute/0107-bnot.c b/tests/execute/0107-bnot.c index 464e7f2..8452577 100644 --- a/tests/execute/0107-bnot.c +++ b/tests/execute/0107-bnot.c @@ -1,10 +1,11 @@ +#include int main() { - int x; - long long l; + int32_t x; + int64_t l; x = 0; l = 0;
[hackers] [scc] [libc] Fix intptr_t in z80 || Roberto E. Vargas Caballero
commit 9f1bdd10088af510c839b7e337d4366df693fe66 Author: Roberto E. Vargas Caballero AuthorDate: Tue Jan 24 17:18:29 2017 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Tue Jan 24 17:18:29 2017 +0100 [libc] Fix intptr_t in z80 diff --git a/libc/include/z80/stdint.h b/libc/include/z80/stdint.h index 5a9f266..1abfffb 100644 --- a/libc/include/z80/stdint.h +++ b/libc/include/z80/stdint.h @@ -32,7 +32,7 @@ typedef unsigned uint16_fast_t; typedef unsigned long uint32_fast_t; typedef unsigned long long uint64_fast_t; -typedef long intptr_t; +typedef int intptr_t; typedef unsigned uintptr_t; typedef long long intmax_t;
[hackers] [scc] [cpp] provide a way to configure sys include paths || Quentin Rameau
commit feaa80c03c85e2732b0fe3e3672f9a541cc4bd4f Author: Quentin Rameau AuthorDate: Tue Jan 24 17:39:51 2017 +0100 Commit: Quentin Rameau 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 @@ -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 @@ -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 @@ -2,6 +2,7 @@ static char sccsid[] = "@(#) ./cc1/arch/amd64-sysv/arch.c"; #include +#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 @@ -1,6 +1,8 @@ /* See LICENSE file for copyright and license details. */ static char sccsid[] = "@(#) ./cc1/arch/i386-sysv/arch.c"; #include + +#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 @@ -2,6 +2,7 @@ static char sccsid[] = "@(#) ./cc1/arch/qbe/arch.c"; #include +#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 @@ -2,6 +2,7 @@ static char sccsid[] = "@(#) ./cc1/arch/z80/arch.c"; #include +#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 @@ -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; @@ -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) @@ -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 000..dba9e7e --- /dev/null +++ b/inc/sysincludes.def.h @@ -0,0 +1,7 @@ +char *sysincludes[] = { + PREFIX "/include/scc/" ARCH "/", + /* configure below your standard sys include paths */ + PREFIX "/include/", + PREFIX "/local/include/", + NULL +};
[hackers] [scc] [cpp] use a shell script instead of cc1 binary || Quentin Rameau
commit 8bd13ada5c51bfa776c719ccc23b5a5b8f64f2e2 Author: Quentin Rameau AuthorDate: Tue Jan 24 18:45:01 2017 +0100 Commit: Quentin Rameau CommitDate: Tue Jan 24 18:48:56 2017 +0100 [cpp] use a shell script instead of cc1 binary By using cpp as scc -E via a shell script, we don't have to worry about default ARCH and can even select it at runtime. diff --git a/Makefile b/Makefile index 1b39f78..970c578 100644 --- a/Makefile +++ b/Makefile @@ -12,11 +12,11 @@ all: driver/$(DRIVER)/scc $(MAKE) $$i || exit; \ done -driver/$(DRIVER)/scc: bin +driver/$(DRIVER)/scc: cd driver/$(DRIVER)/ && $(MAKE) scc ln -f driver/$(DRIVER)/scc bin/scc -$(ARCHS): bin +$(ARCHS): for i in cc1 cc2; \ do \ (cd $$i; \ @@ -25,9 +25,6 @@ $(ARCHS): bin ln -f cc1/cc1-$@ bin/ ln -f cc2/cc2-$@ bin/ -bin: - mkdir -p bin - tests: all cd tests/execute && $(MAKE) -e tests @@ -36,18 +33,17 @@ install: all mkdir -p $(DESTDIR)/$(PREFIX)/bin/ mkdir -p $(DESTDIR)/$(PREFIX)/include/scc/ cp -f bin/cc?-* $(DESTDIR)/$(PREFIX)/libexec/scc/ - cp -f bin/cc1-$(ARCH) $(DESTDIR)/$(PREFIX)/bin/cpp + cp -f bin/cpp.sh $(DESTDIR)/$(PREFIX)/bin/cpp cp -f bin/scc $(DESTDIR)/$(PREFIX)/bin/ cp -fr libc/include/* $(DESTDIR)/$(PREFIX)/include/scc/ find $(DESTDIR)/$(PREFIX)/include/scc/ -type f | xargs chmod 644 cd $(DESTDIR)/$(PREFIX)/libexec/scc/ && chmod 755 cc* && strip cc* - cd $(DESTDIR)/$(PREFIX)/bin && chmod 755 cpp scc && strip cpp scc + cd $(DESTDIR)/$(PREFIX)/bin && chmod 755 cpp scc && strip scc uninstall: rm -rf $(DESTDIR)/$(PREFIX)/include/scc/ rm -rf $(DESTDIR)/$(PREFIX)/libexec/scc/ rm -f $(DESTDIR)/$(PREFIX)/bin/scc - rm -f $(DESTDIR)/$(PREFIX)/bin/cpp clean-helper: for i in $(DIRS); \ @@ -63,5 +59,4 @@ clean: rm -f bin/cc* bin/scc distclean: clean - rm -rf bin rm -f inc/sysincludes.h diff --git a/bin/cpp.sh b/bin/cpp.sh new file mode 100644 index 000..2ea0cce --- /dev/null +++ b/bin/cpp.sh @@ -0,0 +1,2 @@ +#!/bin/sh +scc -E $@
Re: [hackers] [sbase] ed: Don't use strlcpy() || Roberto E. Vargas
> I consider this way of thinking harmful, because it involves You are considered harmful. Regards,
Re: [hackers] [sbase] Revert "ed: remove double free in join()" ||
Hello Thomas, Sorry for the delay, I had some problems with my mail lately, > The trouble with reverting my commit is that readding the double free > completely > crashes ed if more than one join is performed. I think this patch (which also > reverts > back to having no double free) should handle your concern via blocking signal > handling > until the join is finished. Ok, I understand. Mixing longjmp signals and dynamic memory was a really bad idea. Your idea is not bad, but I think we should block sigprocmask and related functions, instead of playing with variables. Regards,
Re: [hackers] [sbase] ed: Don't use strlcpy() || Roberto E. Vargas
On Tue, 24 Jan 2017 21:45:46 +0100 Roberto E. Vargas Caballero wrote: > You are considered harmful. https://es.wikipedia.org/wiki/Argumento_ad_hominem Come with real arguments next time. I honestly expected you to be more mature given your age. -- Laslo Hunhold
Re: [hackers] [dwm][PATCH] Fix signal race condition
> If the signal(2) call within the signal handler fails, die() is called > which in turn is not signal-safe. Therefore, the change to sigaction > makes dwm() more portable among POSIX systems and fixes a signal race > condition. You are right with the original race condition, but I think your solution has also a race condition, because you are not blocking signals while you are in the handler. From my point of view what should be done here is simply: signal(SIGCHLD, SIG_IGN); It will avoid zombie children. Regards,