From deeef55ea9ab300d14e5e14b0d78d6098c80a300 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 2 Jun 2018 21:01:03 +0200 Subject: [PATCH 1/4] Try and *actually* use clang for the clang build. Fixes: #67 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5268370c8..299ac5828 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,5 +20,5 @@ matrix: git: depth: 10 script: - - make PREFIX=/tmp/acki +ack + - make CC=$CC PREFIX=/tmp/acki +ack From 5a886787d31a758d531fce7ecf16983d67d21259 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 2 Jun 2018 21:30:52 +0200 Subject: [PATCH 2/4] Honour CFLAGS set in the Makefile. --- Makefile | 5 +++-- build.lua | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1bfba3939..03b87c926 100644 --- a/Makefile +++ b/Makefile @@ -22,9 +22,9 @@ PREFIX = $(INSDIR) BUILDDIR = $(ACK_TEMP_DIR)/ack-build -# What build flags do you want to use? +# What build flags do you want to use for native code? -CFLAGS = -g +CFLAGS = -g -O -Wno-return-type LDFLAGS = # Various commands. @@ -120,6 +120,7 @@ $(build-file): first/ackbuilder.lua Makefile $(lua-files) $(our-lua) PREFIX=$(PREFIX) \ AR=$(AR) \ CC=$(CC) \ + CFLAGS="$(CFLAGS)" \ > $(build-file) install: diff --git a/build.lua b/build.lua index 1e2405907..f1a1a20e3 100644 --- a/build.lua +++ b/build.lua @@ -1,5 +1,5 @@ vars.cflags = { - "-g", "-O" + "$CFLAGS" } vars.ackcflags = { "-O6" From 911ce7ceb517a624625582d5d363bd53f0dadd6e Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 2 Jun 2018 21:31:18 +0200 Subject: [PATCH 3/4] Crudely tweak some of the prototypes to please clang, which is pickier about K&R C than gcc is. --- h/con_float | 1 - mach/proto/cg/equiv.c | 72 +++++++++++++++++++++++------------------ mach/proto/ncg/fillem.c | 2 +- 3 files changed, 42 insertions(+), 33 deletions(-) diff --git a/h/con_float b/h/con_float index b2ad2908b..903c2ce5b 100644 --- a/h/con_float +++ b/h/con_float @@ -237,7 +237,6 @@ float_cst(str, sz, buf) #endif /* USE_FLT */ #ifdef CODE_GENERATOR -void con_float() { char buf[8]; diff --git a/mach/proto/cg/equiv.c b/mach/proto/cg/equiv.c index 36ef12f92..77e1c0c0a 100644 --- a/mach/proto/cg/equiv.c +++ b/mach/proto/cg/equiv.c @@ -22,27 +22,32 @@ static char rcsid[] = "$Id$"; extern string myalloc(); int rar[MAXCREG]; -rl_p *lar; +rl_p* lar; int maxindex; int regclass[NREGS]; -struct perm *perms; +struct perm* perms; -struct perm * -tuples(regls,nregneeded) rl_p *regls; { - int class=0; - register i,j; +void permute(int index); + +struct perm* tuples(rl_p* regls, int nregneeded) +{ + int class = 0; + register i, j; /* * First compute equivalence classes of registers. */ - for (i=0;ip_next) { - for (i=0; ip_next) + { + for (i = 0; i < maxindex; i++) if (regclass[rar[i]] != regclass[pp->p_rar[i]]) goto diff; - for (i=0; ip_rar[i],pp->p_rar[j])) + for (i = 0; i < maxindex; i++) + for (j = 0; j < i; j++) + if (clash(rar[i], rar[j]) != clash(pp->p_rar[i], pp->p_rar[j])) goto diff; return; - diff: ; + diff:; } - pp = (struct perm *) myalloc(sizeof ( *pp )); + pp = (struct perm*)myalloc(sizeof(*pp)); pp->p_next = perms; - for (i=0; ip_rar[i] = rar[i]; perms = pp; - } else { - rlp=lar[index]; - for (i=rlp->rl_n-1; i>=0; i--) { + } + else + { + rlp = lar[index]; + for (i = rlp->rl_n - 1; i >= 0; i--) + { rar[index] = rlp->rl_list[i]; - permute(index+1); + permute(index + 1); } } } diff --git a/mach/proto/ncg/fillem.c b/mach/proto/ncg/fillem.c index 07e6c9331..7f479337e 100644 --- a/mach/proto/ncg/fillem.c +++ b/mach/proto/ncg/fillem.c @@ -83,7 +83,7 @@ extern short em_ptyp[]; /* machine dependent */ void con_part(int, word); void con_mult(word); -void con_float(void); +int con_float(void); /* actually returns void, but need K&R C compatibility */ void prolog(full nlocals); void mes(word); From 5d292a0a36cd07fef2c0720d23b5b21e3b79fc45 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 2 Jun 2018 21:48:18 +0200 Subject: [PATCH 4/4] Typo fix. --- build.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.lua b/build.lua index f1a1a20e3..5ab18b45e 100644 --- a/build.lua +++ b/build.lua @@ -1,5 +1,5 @@ vars.cflags = { - "$CFLAGS" + "$(CFLAGS)" } vars.ackcflags = { "-O6"