diff options
author | Alain Frisch <alain@frisch.fr> | 2012-12-17 16:07:05 +0000 |
---|---|---|
committer | Alain Frisch <alain@frisch.fr> | 2012-12-17 16:07:05 +0000 |
commit | 7709574b9ae4894a2cde5bf30b0aaa5038360f6c (patch) | |
tree | 9c9be6d739b77b5a5d34eb1f58d6ebc4af51c358 /byterun | |
parent | 2854b1d448e7b0a6f998b593131b6762467f4eb8 (diff) | |
download | ocaml-7709574b9ae4894a2cde5bf30b0aaa5038360f6c.tar.gz |
Sort the primitives file and remove duplicates.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13133 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun')
-rwxr-xr-x | byterun/Makefile.common | 15 |
1 files changed, 14 insertions, 1 deletions
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"'; \ |