summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-10-17 08:17:49 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-10-17 08:17:49 -0700
commit9f158a44b7e88c1dcfb8d56f4f85d642fc423b59 (patch)
tree336dc9997f047c3ea954312b3dbc715157de0b67 /Makefile
parent499f04dc4f9f864071d6ff7e75c9cbec60e2fd12 (diff)
downloadtxr-9f158a44b7e88c1dcfb8d56f4f85d642fc423b59.tar.gz
txr-9f158a44b7e88c1dcfb8d56f4f85d642fc423b59.tar.bz2
txr-9f158a44b7e88c1dcfb8d56f4f85d642fc423b59.zip
Purge stray occurrences of "void *" from code base.
* lib.c (cobj_print_op): In the format call, cast the C pointer to val, since the ~p conversion now takes a val rather than void *. (cptr_equal_op, obj_print, obj_pprint): Remove cast to void *, since obj now already has the type that ~p expects. * lib.h (struct any): Use mem_t * instead of void *. * parser.h (yyscan_t): Repeat the definition from inside the Flex-generated lex.yy.c. (yylex_init, yylex_destroy, yyget_extra, yyset_extra): Re-declare using yyscan_t typedef in place of void *. * parser.l (yyget_column, yyerrprepf): Re-declare using yyscan_t. (grammar): Use yyg in place of yyscanner in calls to yyerrprepf. * parser.y (yylex, %lex-param): Use yyscan_t instead of void *. (parse): Use yyscan_t for local variable. * signal.c (stack): Change type from void * to mem_t *. * stream.c (vformat): Conversion specifier p extracts val instead of void *. (run): Use casts that only remove const, not all the way to void *. * txr.1: Documented p conversion specifier of format. * Makefile (OBJS-y): Initialize with := to make sure it is a simple variable, and not a macro. (SRCS): New variable, listing source files. (enforce): New rule for enforcing coding conventions. Currently checks for void * occurrences.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 12 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index b2f5b936..a68fd849 100644
--- a/Makefile
+++ b/Makefile
@@ -35,11 +35,14 @@ CFLAGS := $(filter-out -Wmissing-prototypes -Wstrict-prototypes,$(CFLAGS))
endif
# TXR objects
+OBJS-y := # make sure OBJ-y is a value variable, not a macro variable
OBJS := txr.o lex.yy.o y.tab.o match.o lib.o regex.o gc.o unwind.o stream.o
OBJS += arith.o hash.o utf8.o filter.o eval.o rand.o combi.o sysif.o
OBJS-$(debug_support) += debug.o
OBJS-$(have_syslog) += syslog.o
OBJS-$(have_posix_sigs) += signal.o
+SRCS := $(filter-out lex.yy.c y.tab.c y.tab.h,\
+ $(shell git ls-files "*.c" "*.h" "*.l" "*.y"))
# MPI objects
MPI_OBJ_BASE=mpi.o mplogic.o
@@ -147,6 +150,15 @@ tests/011/%: TXR_DBG_OPTS :=
%.expected: %.txr
./$(PROG) $(TXR_OPTS) $^ $(TXR_ARGS) > $@
+.PHONY: enforce
+enforce:
+ @if [ $$(grep -E '\<void[\t ]*\*' $(SRCS) | wc -l) -ne 1 ] ; then \
+ echo "New 'void *' occurrences have been found:" ; \
+ grep -n -E '\<void[\t ]*\*' $(SRCS) \
+ | grep -v -F 'typedef void *yyscan_t' ; \
+ exit 1 ; \
+ fi
+
#
# Installation macro.
#