Skip to content

Commit e74ac6a

Browse files
committed
Merge remote-tracking branch 'upstream/master' into palloc
2 parents d3f888f + f913651 commit e74ac6a

File tree

14 files changed

+207
-178
lines changed

14 files changed

+207
-178
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121
2222
- run:
2323
name: Configure
24-
command: ./configure --with-readline
24+
command: ./configure --enable-strict --with-readline
2525

2626
- run:
2727
name: Build
28-
command: make 'ADDCFLAGS=-DGCDEBUG=1 -DREF_ASSERTIONS=1'
28+
command: make
2929

3030
- run:
3131
name: Build test helper

INSTALL

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ use the more up-to-date readline library available, the following is
6969
required:
7070

7171
% doas pkg_add readline # your exact command may differ
72-
% ./configure --with-readline \
72+
% ./configure \
73+
--mandir=/usr/local/man \
74+
--with-readline \
7375
READLINE_CFLAGS=-I/usr/local/include/ereadline \
7476
READLINE_LIBS='-L/usr/local/lib -lereadline'

Makefile.in

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,21 @@ bindir = @bindir@
3535
srcdir = @srcdir@
3636
testdir = @srcdir@/test
3737

38+
VPATH = $(srcdir)
39+
3840

3941
SHELL = /bin/sh
4042
CC = @CC@
43+
YACC = @YACC@
4144
INSTALL = @INSTALL@
42-
INSTALL_PROGRAM = ${INSTALL}
43-
INSTALL_DATA = ${INSTALL} -m 644
45+
INSTALL_PROGRAM = $(INSTALL)
46+
INSTALL_DATA = $(INSTALL) -m 644
4447
MKDIR_P = @MKDIR_P@
4548

4649

47-
## Bison is generating incorrect parsers. So do not use, for now
48-
# YACC = @YACC@
49-
50-
CFLAGS = $(ADDCFLAGS) -I. -I$(srcdir) -W -Wall -Wdeclaration-after-statement @READLINE_CFLAGS@ @CFLAGS@
51-
LDFLAGS = $(ADDLDFLAGS) @LDFLAGS@
52-
LIBS = $(ADDLIBS) @READLINE_LIBS@ @LIBS@
53-
54-
VPATH = $(srcdir)
50+
CFLAGS = @STRICT_CFLAGS@ -I. -I$(srcdir) -W -Wall @READLINE_CFLAGS@ @CFLAGS@ $(ADDCFLAGS)
51+
LDFLAGS = @LDFLAGS@ $(ADDLDFLAGS)
52+
LIBS = @READLINE_LIBS@ @LIBS@ $(ADDLIBS)
5553

5654
HFILES = config.h es.h gc.h input.h prim.h print.h sigmsgs.h \
5755
stdenv.h syntax.h term.h var.h
@@ -70,18 +68,18 @@ GEN = esdump y.tab.c y.tab.h y.output token.h sigmsgs.c initial.c
7068

7169
SIGFILES = @SIGFILES@
7270

73-
es : ${OFILES} initial.o
74-
${CC} -o es ${LDFLAGS} ${OFILES} initial.o ${LIBS}
71+
es : $(OFILES) initial.o
72+
$(CC) -o es $(LDFLAGS) $(OFILES) initial.o $(LIBS)
7573

76-
esdump : ${OFILES} dump.o
77-
${CC} -o esdump ${LDFLAGS} ${OFILES} dump.o ${LIBS}
74+
esdump : $(OFILES) dump.o
75+
$(CC) -o esdump $(LDFLAGS) $(OFILES) dump.o $(LIBS)
7876

7977
clean :
80-
rm -f es testrun ${OFILES} ${GEN} dump.o initial.o
78+
rm -f es $(OFILES) $(GEN) dump.o initial.o
8179

82-
distclean: clean
80+
distclean: clean testclean
8381
rm -f config.cache config.log config.h Makefile cscope.out tags TAGS core cs.out config.status ltmain.sh
84-
rm -rf autom4te.cache
82+
rm -rf autom4te.cache
8583

8684
MANIFEST:
8785
find . -type f | sed s/..// > MANIFEST
@@ -95,16 +93,19 @@ install : es
9593
$(INSTALL_DATA) $(srcdir)/share/* $(DESTDIR)$(datadir)/es
9694

9795
testrun : $(testdir)/testrun.c
98-
${CC} -o testrun $(testdir)/testrun.c
96+
$(CC) -o testrun $(testdir)/testrun.c
9997

10098
test : es testrun $(testdir)/test.es
101-
./es -s < $(testdir)/test.es $(testdir)/tests/*
99+
./es -ps < $(testdir)/test.es $(testdir)/tests/*
100+
101+
testclean :
102+
rm -f testrun
102103

103104
src :
104-
@echo ${OTHER} ${CFILES} ${HFILES}
105+
@echo $(OTHER) $(CFILES) $(HFILES)
105106

106107
y.tab.h : parse.y
107-
${YACC} -vd $(srcdir)/parse.y
108+
$(YACC) -vd $(srcdir)/parse.y
108109

109110
y.tab.c : y.tab.h
110111

@@ -123,41 +124,40 @@ config.h : config.h.in
123124

124125
# --- dependencies ---
125126

126-
access.o : access.c es.h config.h stdenv.h prim.h
127-
closure.o : closure.c es.h config.h stdenv.h gc.h
128-
conv.o : conv.c es.h config.h stdenv.h print.h
129-
dict.o : dict.c es.h config.h stdenv.h gc.h
130-
eval.o : eval.c es.h config.h stdenv.h
131-
except.o : except.c es.h config.h stdenv.h print.h
132-
fd.o : fd.c es.h config.h stdenv.h
133-
gc.o : gc.c es.h config.h stdenv.h gc.h
134-
glob.o : glob.c es.h config.h stdenv.h gc.h
135-
glom.o : glom.c es.h config.h stdenv.h gc.h
136-
input.o : input.c es.h config.h stdenv.h input.h
137-
heredoc.o : heredoc.c es.h config.h stdenv.h gc.h input.h syntax.h
138-
history.o : history.c es.h config.h stdenv.h gc.h input.h
139-
list.o : list.c es.h config.h stdenv.h gc.h
140-
main.o : main.c es.h config.h stdenv.h
141-
match.o : match.c es.h config.h stdenv.h
142-
open.o : open.c es.h config.h stdenv.h
143-
opt.o : opt.c es.h config.h stdenv.h
144-
prim.o : prim.c es.h config.h stdenv.h prim.h
145-
prim-ctl.o : prim-ctl.c es.h config.h stdenv.h prim.h
146-
prim-etc.o : prim-etc.c es.h config.h stdenv.h prim.h
147-
prim-io.o : prim-io.c es.h config.h stdenv.h gc.h prim.h
148-
readline.o : readline.c es.h config.h stdenv.h prim.h
149-
prim-sys.o : prim-sys.c es.h config.h stdenv.h prim.h
150-
print.o : print.c es.h config.h stdenv.h print.h
151-
proc.o : proc.c es.h config.h stdenv.h prim.h
152-
signal.o : signal.c es.h config.h stdenv.h sigmsgs.h
153-
split.o : split.c es.h config.h stdenv.h gc.h
154-
status.o : status.c es.h config.h stdenv.h term.h
155-
str.o : str.c es.h config.h stdenv.h gc.h print.h
156-
syntax.o : syntax.c es.h config.h stdenv.h input.h syntax.h token.h
157-
term.o : term.c es.h config.h stdenv.h gc.h term.h
158-
token.o : token.c es.h config.h stdenv.h input.h syntax.h token.h
159-
tree.o : tree.c es.h config.h stdenv.h gc.h
160-
util.o : util.c es.h config.h stdenv.h
161-
var.o : var.c es.h config.h stdenv.h gc.h var.h term.h
162-
vec.o : vec.c es.h config.h stdenv.h gc.h
163-
version.o : version.c es.h config.h stdenv.h
127+
access.o : access.c es.h config.h stdenv.h prim.h
128+
closure.o : closure.c es.h config.h stdenv.h gc.h
129+
conv.o : conv.c es.h config.h stdenv.h print.h
130+
dict.o : dict.c es.h config.h stdenv.h gc.h
131+
eval.o : eval.c es.h config.h stdenv.h
132+
except.o : except.c es.h config.h stdenv.h print.h
133+
fd.o : fd.c es.h config.h stdenv.h
134+
gc.o : gc.c es.h config.h stdenv.h gc.h
135+
glob.o : glob.c es.h config.h stdenv.h gc.h
136+
glom.o : glom.c es.h config.h stdenv.h gc.h
137+
input.o : input.c es.h config.h stdenv.h input.h
138+
heredoc.o : heredoc.c es.h config.h stdenv.h gc.h input.h syntax.h
139+
list.o : list.c es.h config.h stdenv.h gc.h
140+
main.o : main.c es.h config.h stdenv.h
141+
match.o : match.c es.h config.h stdenv.h
142+
open.o : open.c es.h config.h stdenv.h
143+
opt.o : opt.c es.h config.h stdenv.h
144+
prim.o : prim.c es.h config.h stdenv.h prim.h
145+
prim-ctl.o : prim-ctl.c es.h config.h stdenv.h prim.h
146+
prim-etc.o : prim-etc.c es.h config.h stdenv.h prim.h
147+
prim-io.o : prim-io.c es.h config.h stdenv.h gc.h prim.h
148+
readline.o : readline.c es.h config.h stdenv.h prim.h
149+
prim-sys.o : prim-sys.c es.h config.h stdenv.h prim.h
150+
print.o : print.c es.h config.h stdenv.h print.h
151+
proc.o : proc.c es.h config.h stdenv.h prim.h
152+
signal.o : signal.c es.h config.h stdenv.h sigmsgs.h
153+
split.o : split.c es.h config.h stdenv.h gc.h
154+
status.o : status.c es.h config.h stdenv.h term.h
155+
str.o : str.c es.h config.h stdenv.h gc.h print.h
156+
syntax.o : syntax.c es.h config.h stdenv.h input.h syntax.h token.h
157+
term.o : term.c es.h config.h stdenv.h gc.h term.h
158+
token.o : token.c es.h config.h stdenv.h input.h syntax.h token.h
159+
tree.o : tree.c es.h config.h stdenv.h gc.h
160+
util.o : util.c es.h config.h stdenv.h
161+
var.o : var.c es.h config.h stdenv.h gc.h var.h term.h
162+
vec.o : vec.c es.h config.h stdenv.h gc.h
163+
version.o : version.c es.h config.h stdenv.h

configure.ac

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ rm -f conftest*
1818

1919
AC_CANONICAL_HOST
2020

21+
dnl Build configuration.
22+
23+
AC_ARG_ENABLE(strict, AS_HELP_STRING([--enable-strict], [enable strict compiler flags for testing and debugging; not all compilers support these]), opt_strict_mode=$enableval, opt_strict_mode=no)
24+
25+
if test $opt_strict_mode = yes; then
26+
AC_SUBST([STRICT_CFLAGS], ["-ansi -pedantic -DGCDEBUG=1 -D_POSIX_C_SOURCE=200112L -DREF_ASSERTIONS=1"])
27+
fi
28+
2129
dnl Checks for programs.
2230
AC_PROG_CC
2331
AC_PROG_CPP
@@ -49,7 +57,6 @@ ES_WITH_READLINE
4957

5058
dnl Checks for header files.
5159
AC_HEADER_DIRENT
52-
AC_HEADER_STDC
5360
AC_HEADER_SYS_WAIT
5461
AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h memory.h stdarg.h sys/cdefs.h)
5562

es.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ extern List *sortlist(List *list);
136136

137137
/* tree.c */
138138

139-
extern Tree *gcmk(NodeKind VARARGS);
139+
extern Tree *gcmk(NodeKind VARARGS); /* gcalloc a tree node */
140140

141141

142142
/* closure.c */
@@ -413,8 +413,9 @@ extern void gcenable(void); /* enable collections */
413413
extern void gcdisable(void); /* disable collections */
414414
extern Boolean gcisblocked(void); /* is collection disabled? */
415415

416-
extern void *palloc(size_t n, Tag *t); /* allocate like gcalloc but in pspace */
417-
extern void *pseal(void *p); /* collect pspace into gcspace with one root */
416+
/* operations with pspace, the explicitly-collected gc space for parse tree building */
417+
extern void *palloc(size_t n, Tag *t); /* allocate n with collection tag t, but in pspace */
418+
extern void *pseal(void *p); /* collect pspace into gcspace with root p */
418419
extern char *pdup(const char *s); /* copy a 0-terminated string into pspace */
419420
extern char *pndup(const char *s, size_t n); /* copy a counted string into pspace */
420421

0 commit comments

Comments
 (0)