From c7cf750d1c44fe28535306628f34d7133611a948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Hinderer?= Date: Wed, 10 Feb 2016 16:22:39 +0100 Subject: [PATCH] Fixes issue #48. This problem was due to the following issue in the OCaml compilers: http://caml.inria.fr/mantis/view.php?id=6661 This was actually already fixed by commits 33d2565da2cc, 4b27d7c6b404 and b87e9ae2524190. This previous fix was however incomplete (working only for the byte-code versoin of Coccinelle) and hackish. The current fix also works for the native-code version of Coccinelle and does not rely on Makefile and sed tricks. --- ocaml/Makefile | 1 - ocaml/exposed_modules.ml | 42 +++++++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/ocaml/Makefile b/ocaml/Makefile index 5d12294be..d90b1d933 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -48,7 +48,6 @@ all.opt: $(TARGET).cma: $(OBJS) $(OCAMLC_CMD) -a -o $(TARGET).cma $(OBJS) - for i in `grep " (\*" exposed_modules.ml | sed "s/^.*(\* //" | sed "s/\..* \*)$$//"`; do cp ../$$i.cmi .; done $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa) $(OCAMLOPT_CMD) -a -o $(TARGET).cmxa $(OPTOBJS) diff --git a/ocaml/exposed_modules.ml b/ocaml/exposed_modules.ml index b48f0c00c..84f576c4d 100644 --- a/ocaml/exposed_modules.ml +++ b/ocaml/exposed_modules.ml @@ -1,22 +1,32 @@ (* Modules accessible by the ocaml scripts. *) -module Ast_c = Ast_c (* parsing_c/ast_c.ml *) -module Parse_c = Parse_c (* parsing_c/parse_c.ml *) -module Parser_c = Parser_c (* parsing_c/parser_c.mly *) -module Lexer_c = Lexer_c (* parsing_c/lexer_c.mll *) -module Pretty_print_c = Pretty_print_c (* parsing_c/pretty_print_c.ml *) -module Lib_parsing_c = Lib_parsing_c (* parsing_c/lib_parsing_c.ml *) -module Visitor_c = Visitor_c (* parsing_c/visitor_c.ml *) +(* + We use + module Foo = struct include Bar end + rather than + module Foo = Bar + Because of an incompatible change in the interpretation of + module aliases introduced in OCaml 4.02.1. + See http://caml.inria.fr/mantis/view.php?id=6661 +*) -module Regexp = Regexp (* globals/regexp.ml *) -module Config = Config (* globals/config.ml *) -module Flag = Flag (* globals/flag.ml *) -module Iteration = Iteration (* globals/iteration.ml *) -module Common = Common (* commons/common.ml *) +module Ast_c = struct include Ast_c end +module Parse_c = struct include Parse_c end +module Parser_c = struct include Parser_c end +module Lexer_c = struct include Lexer_c end +module Pretty_print_c = struct include Pretty_print_c end +module Lib_parsing_c = struct include Lib_parsing_c end +module Visitor_c = struct include Visitor_c end -module Ast_cocci = Ast_cocci (* parsing_cocci/ast_cocci.ml *) -module Ast0_cocci = Ast0_cocci (* parsing_cocci/ast0_cocci.ml *) -module Type_cocci = Type_cocci (* parsing_cocci/type_cocci.ml *) +module Regexp = struct include Regexp end +module Config = struct include Config end +module Flag = struct include Flag end +module Iteration = struct include Iteration end +module Common = struct include Common end -module Dumper = Dumper +module Ast_cocci = struct include Ast_cocci end +module Ast0_cocci = struct include Ast0_cocci end +module Type_cocci = struct include Type_cocci end + +module Dumper = struct include Dumper end