Skip to content

Commit

Permalink
Already upstreamed: stdlib capitalisation patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mshinwell authored and poechsel committed Jun 25, 2021
1 parent b19e89c commit a9098f8
Show file tree
Hide file tree
Showing 14 changed files with 693 additions and 686 deletions.
1,234 changes: 617 additions & 617 deletions ocaml/stdlib/.depend

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions ocaml/stdlib/Compflags
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ case $1 in
camlinternalOO.cmx) echo ' -inline 0 -afl-inst-ratio 0';;
camlinternalLazy.cmx) echo ' -afl-inst-ratio 0';;
# never instrument camlinternalOO or camlinternalLazy (PR#7725)
stdlib__buffer.cmx) echo ' -inline 3';;
stdlib__Buffer.cmx) echo ' -inline 3';;
# make sure add_char is inlined (PR#5872)
stdlib__buffer.cm[io]) echo ' -w A';;
stdlib__Buffer.cm[io]) echo ' -w A';;
camlinternalFormat.cm[io]) echo ' -w Ae';;
stdlib__printf.cm[io]|stdlib__format.cm[io]|stdlib__scanf.cm[io])
stdlib__Printf.cm[io]|stdlib__Format.cm[io]|stdlib__Scanf.cm[io])
echo ' -w Ae';;
stdlib__scanf.cmx) echo ' -inline 9';;
stdlib__Scanf.cmx) echo ' -inline 9';;
*Labels.cmi) echo ' -pp "$AWK -f ./expand_module_aliases.awk"';;
*Labels.cm[ox]) echo ' -nolabels -no-alias-deps';;
stdlib__float.cm[ox]) echo ' -nolabels -no-alias-deps';;
stdlib__oo.cmi) echo ' -no-principal';;
stdlib__Float.cm[ox]) echo ' -nolabels -no-alias-deps';;
stdlib__Oo.cmi) echo ' -no-principal';;
# preserve structure sharing in Oo.copy (PR#9767)
*) echo ' ';;
esac
23 changes: 13 additions & 10 deletions ocaml/stdlib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ OBJS=$(addsuffix .cmo,$(STDLIB_MODULES))
NOSTDLIB= camlinternalFormatBasics.cmo camlinternalAtomic.cmo stdlib.cmo
OTHERS=$(filter-out $(NOSTDLIB),$(OBJS))

PREFIXED_OBJS=$(filter stdlib__%.cmo,$(OBJS))
UNPREFIXED_OBJS=$(PREFIXED_OBJS:stdlib__%.cmo=%)

.PHONY: all
all: stdlib.cma std_exit.cmo camlheader target_camlheader camlheader_ur

Expand Down Expand Up @@ -200,21 +197,21 @@ export AWK
%.cmi: %.mli
$(CAMLC) $(COMPFLAGS) $(shell ./Compflags $@) -c $<

stdlib__%.cmi: %.mli
$(CAMLC) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $<
stdlib__%.cmi:
$(CAMLC) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $(filter %.mli, $^)

%.cmo: %.ml
$(CAMLC) $(COMPFLAGS) $(shell ./Compflags $@) -c $<

stdlib__%.cmo: %.ml
$(CAMLC) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $<
stdlib__%.cmo:
$(CAMLC) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $(filter %.ml, $^)

%.cmx: %.ml
$(CAMLOPT) $(COMPFLAGS) $(OPTCOMPFLAGS) $(shell ./Compflags $@) -c $<

stdlib__%.cmx: %.ml
stdlib__%.cmx:
$(CAMLOPT) $(COMPFLAGS) $(OPTCOMPFLAGS) $(shell ./Compflags $@) \
-o $@ -c $<
-o $@ -c $(filter %.ml, $^)

# Dependencies on the compiler
COMPILER_DEPS=$(filter-out -use-prims $(CAMLRUN), $(CAMLC))
Expand All @@ -237,13 +234,19 @@ include .depend
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)

RAW_OBJS=$(addsuffix .cmo,$(STDLIB_DEP_MODULES))
PREFIXED_OBJS=$(filter stdlib__%.cmo,$(RAW_OBJS))
UNPREFIXED_OBJS=$(PREFIXED_OBJS:stdlib__%.cmo=%)
UNPREFIXED_OBJS_DISJUNCTION=${subst ${SPACE},|,${UNPREFIXED_OBJS}}

.PHONY: depend
depend:
$(CAMLDEP) $(DEPFLAGS) $(filter-out stdlib.%,$(wildcard *.mli *.ml)) \
> .depend.tmp
$(CAMLDEP) $(DEPFLAGS) -pp "$(AWK) -f ./remove_module_aliases.awk" \
stdlib.ml stdlib.mli >> .depend.tmp
sed -Ee \
's#(^| )(${subst ${SPACE},|,${UNPREFIXED_OBJS}})[.]#\1stdlib__\2.#g' \
's#(^| )(${UNPREFIXED_OBJS_DISJUNCTION})[.]#\1stdlib__\u\2.#g' \
-e 's/^stdlib__(.)(.*)(\.[^i]*)(i?) :/stdlib__\1\2\3\4 : \l\1\2.ml\4/' \
.depend.tmp > .depend
rm -f .depend.tmp
11 changes: 9 additions & 2 deletions ocaml/stdlib/StdlibModules
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
# add stdlib__ as prefix to a module except for internal modules
# and the stdlib module itself
define add_stdlib_prefix
$(or $(filter stdlib camlinternal%,$1), stdlib__$1)
$(or $(filter stdlib camlinternal%,$1),\
stdlib__$(shell echo $1 | cut -c1 | tr '[:lower:]' '[:upper:]')$\
$(shell echo $1 | cut -c2-))
endef
define add_stdlib_dep_prefix
$(or $(filter stdlib camlinternal%,$1),stdlib__$1)
endef

# Modules should be listed in dependency order.
Expand All @@ -40,5 +45,7 @@ STDLIB_MODS=\
filename complex arrayLabels listLabels bytesLabels stringLabels moreLabels \
stdLabels bigarray

STDLIB_MODULES=\
STDLIB_MODULES:=\
$(foreach module, $(STDLIB_MODS), $(call add_stdlib_prefix,$(module)))
STDLIB_DEP_MODULES:=\
$(foreach module, $(STDLIB_MODS), $(call add_stdlib_dep_prefix,$(module)))
5 changes: 1 addition & 4 deletions ocaml/stdlib/expand_module_aliases.awk
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ NR == 1 { printf ("# 1 \"%s\"\n", FILENAME) }
state=2;
else if ($1 == "module")
{ if (ocamldoc!="true") printf("\n(** @canonical %s *)", $2);
first_letter=substr($4,1,1);
if (dune_wrapped!="true")
first_letter=tolower(first_letter);
printf("\nmodule %s = Stdlib__%s%s\n", $2, first_letter, substr($4,2));
printf("\nmodule %s = Stdlib__%s\n", $2, $4);
}
else
print
Expand Down
12 changes: 6 additions & 6 deletions ocaml/testsuite/tests/backtrace/backtrace2.reference
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, char
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 38, characters 6-11
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 9-42
Re-raised at Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 61-70
Called from Backtrace2.run in file "backtrace2.ml", line 62, characters 11-23
Expand All @@ -54,11 +54,11 @@ Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, char
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 38, characters 6-11
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 9-42
Re-raised at Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 61-70
Called from Backtrace2.run in file "backtrace2.ml", line 62, characters 11-23
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Called from Backtrace2.test_lazy.exception_raised_internally in file "backtrace2.ml", line 50, characters 8-41
Re-raised at Backtrace2.test_lazy.aux in file "backtrace2.ml", line 47, characters 18-33
Called from Backtrace2.test_lazy.aux in file "backtrace2.ml", line 47, characters 43-52
Expand All @@ -77,11 +77,11 @@ Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, char
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 38, characters 6-11
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 9-42
Re-raised at Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 61-70
Called from Backtrace2.run in file "backtrace2.ml", line 62, characters 11-23
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Called from Backtrace2.test_lazy.exception_raised_internally in file "backtrace2.ml", line 50, characters 8-41
Re-raised at Backtrace2.test_lazy.aux in file "backtrace2.ml", line 47, characters 18-33
Called from Backtrace2.test_lazy.aux in file "backtrace2.ml", line 47, characters 43-52
Expand All @@ -92,7 +92,7 @@ Called from Backtrace2.test_lazy.aux in file "backtrace2.ml", line 47, character
Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml", line 31, characters 17-27
Re-raised at CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml", line 36, characters 4-11
Called from Backtrace2.run in file "backtrace2.ml", line 62, characters 11-23
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
Called from Backtrace2.test_lazy.exception_raised_internally in file "backtrace2.ml", line 50, characters 8-41
Re-raised at CamlinternalLazy.force_lazy_block.(fun) in file "camlinternalLazy.ml", line 35, characters 56-63
Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml", line 31, characters 17-27
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Called from Test10_plugin in file "test10_plugin.ml", line 10, characters 2-6
Called from Dynlink.Bytecode.run in file "otherlibs/dynlink/dynlink.ml", line 137, characters 16-25
Re-raised at Dynlink.Bytecode.run in file "otherlibs/dynlink/dynlink.ml", line 139, characters 6-137
Called from Dynlink_common.Make.load.(fun) in file "otherlibs/dynlink/dynlink_common.ml", line 347, characters 13-44
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Dynlink_common.Make.load in file "otherlibs/dynlink/dynlink_common.ml", line 345, characters 8-240
Re-raised at Dynlink_common.Make.load in file "otherlibs/dynlink/dynlink_common.ml", line 355, characters 8-17
Called from Test10_main in file "test10_main.ml", line 51, characters 13-69
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Called from Test10_plugin in file "test10_plugin.ml", line 10, characters 2-6
Called from Dynlink.Native.run.(fun) in file "otherlibs/dynlink/native/dynlink.ml", line 85, characters 12-29
Called from Dynlink.Native.run.(fun) in file "otherlibs/dynlink/native/dynlink.ml", line 85, characters 12-29
Re-raised at Dynlink.Native.run.(fun) in file "otherlibs/dynlink/native/dynlink.ml", line 87, characters 10-149
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Dynlink_common.Make.load.(fun) in file "otherlibs/dynlink/dynlink_common.ml", line 347, characters 13-44
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Dynlink_common.Make.load in file "otherlibs/dynlink/dynlink_common.ml", line 345, characters 8-240
Re-raised at Dynlink_common.Make.load in file "otherlibs/dynlink/dynlink_common.ml", line 355, characters 8-17
Called from Dynlink_common.Make.loadfile in file "otherlibs/dynlink/dynlink_common.ml" (inlined), line 357, characters 26-45
Expand Down
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
-----------
Raised by primitive operation at Callstacks.alloc_list_literal in file "callstacks.ml", line 18, characters 30-53
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.alloc_pair in file "callstacks.ml", line 21, characters 30-76
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.alloc_record in file "callstacks.ml", line 26, characters 12-66
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.alloc_some in file "callstacks.ml", line 29, characters 30-60
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.alloc_array_literal in file "callstacks.ml", line 32, characters 30-55
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.alloc_float_array_literal in file "callstacks.ml", line 36, characters 12-62
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.do_alloc_unknown_array_literal in file "callstacks.ml", line 39, characters 22-27
Called from Callstacks.alloc_unknown_array_literal in file "callstacks.ml", line 41, characters 30-65
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.alloc_small_array in file "callstacks.ml", line 44, characters 30-69
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.alloc_large_array in file "callstacks.ml", line 47, characters 30-73
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.alloc_closure.(fun) in file "callstacks.ml", line 51, characters 30-43
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.get0 in file "callstacks.ml", line 54, characters 28-33
Called from Callstacks.getfloatfield in file "callstacks.ml", line 56, characters 30-47
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Stdlib__marshal.from_bytes in file "marshal.ml", line 61, characters 9-35
Raised by primitive operation at Stdlib__Marshal.from_bytes in file "marshal.ml", line 61, characters 9-35
Called from Callstacks.alloc_unmarshal in file "callstacks.ml", line 62, characters 12-87
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.alloc_ref in file "callstacks.ml", line 65, characters 30-59
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
-----------
Raised by primitive operation at Callstacks.prod_floats in file "callstacks.ml", line 68, characters 37-43
Called from Callstacks.alloc_boxedfloat in file "callstacks.ml", line 70, characters 30-49
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
Loading

0 comments on commit a9098f8

Please sign in to comment.