From 7709574b9ae4894a2cde5bf30b0aaa5038360f6c Mon Sep 17 00:00:00 2001 From: Alain Frisch Date: Mon, 17 Dec 2012 16:07:05 +0000 Subject: Sort the primitives file and remove duplicates. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13133 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- byterun/Makefile.common | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'byterun') diff --git a/byterun/Makefile.common b/byterun/Makefile.common index 925ae76e11..bfc5573802 100755 --- a/byterun/Makefile.common +++ b/byterun/Makefile.common @@ -69,9 +69,22 @@ install-runtimed: cp libcamlrund.$(A) $(LIBDIR)/libcamlrund.$(A) .PHONY: install-runtimed +# If primitives contain duplicated lines (e.g. because the code is defined +# like +# #ifdef X +# CAMLprim value caml_foo() ... +# #else +# CAMLprim value caml_foo() ... +# end), horrible things will happen (duplicated entries in Runtimedef -> +# double registration in Symtable -> empty entry in the PRIM table -> +# the bytecode interpreter is confused). +# We sort the primitive file and remove duplicates to avoid this problem. + primitives : $(PRIMS) sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \ - $(PRIMS) > primitives + $(PRIMS) > primitives.tmp + sort primitives.tmp | uniq > primitives + rm primitives.tmp prims.c : primitives (echo '#include "mlvalues.h"'; \ -- cgit v1.2.1