diff --git a/.circleci/config.yml b/.circleci/config.yml index 19f2cf56..0421308e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,11 +21,11 @@ jobs: - run: name: Configure - command: ./configure --with-readline + command: ./configure --enable-strict --with-readline - run: name: Build - command: make 'ADDCFLAGS=-DGCDEBUG=1 -DREF_ASSERTIONS=1' + command: make - run: name: Build test helper @@ -51,7 +51,7 @@ jobs: name: Test command: | mkdir -p ./test/results - ./es -s < ./test/test.es --junit ./test/tests/* > ./test/results/results.xml + ./es -ps < ./test/test.es --junit ./test/tests/* > ./test/results/results.xml - store_artifacts: path: ./test/results/ diff --git a/Makefile.in b/Makefile.in index 98654960..c81645b8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,23 +35,21 @@ bindir = @bindir@ srcdir = @srcdir@ testdir = @srcdir@/test +VPATH = $(srcdir) + SHELL = /bin/sh CC = @CC@ +YACC = @YACC@ INSTALL = @INSTALL@ -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = $(INSTALL) +INSTALL_DATA = $(INSTALL) -m 644 MKDIR_P = @MKDIR_P@ -## Bison is generating incorrect parsers. So do not use, for now -# YACC = @YACC@ - -CFLAGS = $(ADDCFLAGS) -I. -I$(srcdir) -W -Wall -Wdeclaration-after-statement @READLINE_CFLAGS@ @CFLAGS@ -LDFLAGS = $(ADDLDFLAGS) @LDFLAGS@ -LIBS = $(ADDLIBS) @READLINE_LIBS@ @LIBS@ - -VPATH = $(srcdir) +CFLAGS = @STRICT_CFLAGS@ -I. -I$(srcdir) -W -Wall @READLINE_CFLAGS@ @CFLAGS@ $(ADDCFLAGS) +LDFLAGS = @LDFLAGS@ $(ADDLDFLAGS) +LIBS = @READLINE_LIBS@ @LIBS@ $(ADDLIBS) HFILES = config.h es.h gc.h input.h prim.h print.h sigmsgs.h \ 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 SIGFILES = @SIGFILES@ -es : ${OFILES} initial.o - ${CC} -o es ${LDFLAGS} ${OFILES} initial.o ${LIBS} +es : $(OFILES) initial.o + $(CC) -o es $(LDFLAGS) $(OFILES) initial.o $(LIBS) -esdump : ${OFILES} dump.o - ${CC} -o esdump ${LDFLAGS} ${OFILES} dump.o ${LIBS} +esdump : $(OFILES) dump.o + $(CC) -o esdump $(LDFLAGS) $(OFILES) dump.o $(LIBS) clean : - rm -f es testrun ${OFILES} ${GEN} dump.o initial.o + rm -f es $(OFILES) $(GEN) dump.o initial.o -distclean: clean +distclean: clean testclean rm -f config.cache config.log config.h Makefile cscope.out tags TAGS core cs.out config.status ltmain.sh - rm -rf autom4te.cache + rm -rf autom4te.cache MANIFEST: find . -type f | sed s/..// > MANIFEST @@ -95,16 +93,19 @@ install : es $(INSTALL_DATA) $(srcdir)/share/* $(DESTDIR)$(datadir)/es testrun : $(testdir)/testrun.c - ${CC} -o testrun $(testdir)/testrun.c + $(CC) -o testrun $(testdir)/testrun.c test : es testrun $(testdir)/test.es - ./es -s < $(testdir)/test.es $(testdir)/tests/* + ./es -ps < $(testdir)/test.es $(testdir)/tests/* + +testclean : + rm -f testrun src : - @echo ${OTHER} ${CFILES} ${HFILES} + @echo $(OTHER) $(CFILES) $(HFILES) y.tab.h : parse.y - ${YACC} -vd $(srcdir)/parse.y + $(YACC) -vd $(srcdir)/parse.y y.tab.c : y.tab.h @@ -123,40 +124,40 @@ config.h : config.h.in # --- dependencies --- -access.o : access.c es.h config.h stdenv.h prim.h -closure.o : closure.c es.h config.h stdenv.h gc.h -conv.o : conv.c es.h config.h stdenv.h print.h -dict.o : dict.c es.h config.h stdenv.h gc.h -eval.o : eval.c es.h config.h stdenv.h -except.o : except.c es.h config.h stdenv.h print.h -fd.o : fd.c es.h config.h stdenv.h -gc.o : gc.c es.h config.h stdenv.h gc.h -glob.o : glob.c es.h config.h stdenv.h gc.h -glom.o : glom.c es.h config.h stdenv.h gc.h -input.o : input.c es.h config.h stdenv.h input.h -heredoc.o : heredoc.c es.h config.h stdenv.h gc.h input.h syntax.h -history.o : history.c es.h config.h stdenv.h gc.h input.h -list.o : list.c es.h config.h stdenv.h gc.h -main.o : main.c es.h config.h stdenv.h -match.o : match.c es.h config.h stdenv.h -open.o : open.c es.h config.h stdenv.h -opt.o : opt.c es.h config.h stdenv.h -prim.o : prim.c es.h config.h stdenv.h prim.h -prim-ctl.o : prim-ctl.c es.h config.h stdenv.h prim.h -prim-etc.o : prim-etc.c es.h config.h stdenv.h prim.h -prim-io.o : prim-io.c es.h config.h stdenv.h gc.h prim.h -prim-sys.o : prim-sys.c es.h config.h stdenv.h prim.h -print.o : print.c es.h config.h stdenv.h print.h -proc.o : proc.c es.h config.h stdenv.h prim.h -signal.o : signal.c es.h config.h stdenv.h sigmsgs.h -split.o : split.c es.h config.h stdenv.h gc.h -status.o : status.c es.h config.h stdenv.h term.h -str.o : str.c es.h config.h stdenv.h gc.h print.h -syntax.o : syntax.c es.h config.h stdenv.h input.h syntax.h token.h -term.o : term.c es.h config.h stdenv.h gc.h term.h -token.o : token.c es.h config.h stdenv.h input.h syntax.h token.h -tree.o : tree.c es.h config.h stdenv.h gc.h -util.o : util.c es.h config.h stdenv.h -var.o : var.c es.h config.h stdenv.h gc.h var.h term.h -vec.o : vec.c es.h config.h stdenv.h gc.h -version.o : version.c es.h config.h stdenv.h +access.o : access.c es.h config.h stdenv.h prim.h +closure.o : closure.c es.h config.h stdenv.h gc.h +conv.o : conv.c es.h config.h stdenv.h print.h +dict.o : dict.c es.h config.h stdenv.h gc.h +eval.o : eval.c es.h config.h stdenv.h +except.o : except.c es.h config.h stdenv.h print.h +fd.o : fd.c es.h config.h stdenv.h +gc.o : gc.c es.h config.h stdenv.h gc.h +glob.o : glob.c es.h config.h stdenv.h gc.h +glom.o : glom.c es.h config.h stdenv.h gc.h +input.o : input.c es.h config.h stdenv.h input.h +heredoc.o : heredoc.c es.h config.h stdenv.h gc.h input.h syntax.h +history.o : history.c es.h config.h stdenv.h gc.h input.h +list.o : list.c es.h config.h stdenv.h gc.h +main.o : main.c es.h config.h stdenv.h +match.o : match.c es.h config.h stdenv.h +open.o : open.c es.h config.h stdenv.h +opt.o : opt.c es.h config.h stdenv.h +prim.o : prim.c es.h config.h stdenv.h prim.h +prim-ctl.o : prim-ctl.c es.h config.h stdenv.h prim.h +prim-etc.o : prim-etc.c es.h config.h stdenv.h prim.h +prim-io.o : prim-io.c es.h config.h stdenv.h gc.h prim.h +prim-sys.o : prim-sys.c es.h config.h stdenv.h prim.h +print.o : print.c es.h config.h stdenv.h print.h +proc.o : proc.c es.h config.h stdenv.h prim.h +signal.o : signal.c es.h config.h stdenv.h sigmsgs.h +split.o : split.c es.h config.h stdenv.h gc.h +status.o : status.c es.h config.h stdenv.h term.h +str.o : str.c es.h config.h stdenv.h gc.h print.h +syntax.o : syntax.c es.h config.h stdenv.h input.h syntax.h token.h +term.o : term.c es.h config.h stdenv.h gc.h term.h +token.o : token.c es.h config.h stdenv.h input.h syntax.h token.h +tree.o : tree.c es.h config.h stdenv.h gc.h +util.o : util.c es.h config.h stdenv.h +var.o : var.c es.h config.h stdenv.h gc.h var.h term.h +vec.o : vec.c es.h config.h stdenv.h gc.h +version.o : version.c es.h config.h stdenv.h diff --git a/configure.ac b/configure.ac index 09b9dade..3977c61d 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,14 @@ rm -f conftest* AC_CANONICAL_HOST +dnl Build configuration. + +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) + +if test $opt_strict_mode = yes; then + AC_SUBST([STRICT_CFLAGS], ["-ansi -pedantic -DGCDEBUG=1 -D_POSIX_C_SOURCE=200112L -DREF_ASSERTIONS=1"]) +fi + dnl Checks for programs. AC_PROG_CC AC_PROG_CPP @@ -49,7 +57,6 @@ ES_WITH_READLINE dnl Checks for header files. AC_HEADER_DIRENT -AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h memory.h stdarg.h sys/cdefs.h)