Skip to content

Commit a4b9e0d

Browse files
mshinwellpoechsel
authored andcommitted
flambda-backend: Already upstreamed: stdlib capitalisation patch
1 parent 4c1c259 commit a4b9e0d

14 files changed

+693
-686
lines changed

stdlib/.depend

Lines changed: 617 additions & 617 deletions
Large diffs are not rendered by default.

stdlib/Compflags

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ case $1 in
2525
camlinternalOO.cmx) echo ' -inline 0 -afl-inst-ratio 0';;
2626
camlinternalLazy.cmx) echo ' -afl-inst-ratio 0';;
2727
# never instrument camlinternalOO or camlinternalLazy (PR#7725)
28-
stdlib__buffer.cmx) echo ' -inline 3';;
28+
stdlib__Buffer.cmx) echo ' -inline 3';;
2929
# make sure add_char is inlined (PR#5872)
30-
stdlib__buffer.cm[io]) echo ' -w A';;
30+
stdlib__Buffer.cm[io]) echo ' -w A';;
3131
camlinternalFormat.cm[io]) echo ' -w Ae';;
32-
stdlib__printf.cm[io]|stdlib__format.cm[io]|stdlib__scanf.cm[io])
32+
stdlib__Printf.cm[io]|stdlib__Format.cm[io]|stdlib__Scanf.cm[io])
3333
echo ' -w Ae';;
34-
stdlib__scanf.cmx) echo ' -inline 9';;
34+
stdlib__Scanf.cmx) echo ' -inline 9';;
3535
*Labels.cmi) echo ' -pp "$AWK -f ./expand_module_aliases.awk"';;
3636
*Labels.cm[ox]) echo ' -nolabels -no-alias-deps';;
37-
stdlib__float.cm[ox]) echo ' -nolabels -no-alias-deps';;
38-
stdlib__oo.cmi) echo ' -no-principal';;
37+
stdlib__Float.cm[ox]) echo ' -nolabels -no-alias-deps';;
38+
stdlib__Oo.cmi) echo ' -no-principal';;
3939
# preserve structure sharing in Oo.copy (PR#9767)
4040
*) echo ' ';;
4141
esac

stdlib/Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ OBJS=$(addsuffix .cmo,$(STDLIB_MODULES))
4040
NOSTDLIB= camlinternalFormatBasics.cmo camlinternalAtomic.cmo stdlib.cmo
4141
OTHERS=$(filter-out $(NOSTDLIB),$(OBJS))
4242

43-
PREFIXED_OBJS=$(filter stdlib__%.cmo,$(OBJS))
44-
UNPREFIXED_OBJS=$(PREFIXED_OBJS:stdlib__%.cmo=%)
45-
4643
.PHONY: all
4744
all: stdlib.cma std_exit.cmo camlheader target_camlheader camlheader_ur
4845

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

203-
stdlib__%.cmi: %.mli
204-
$(CAMLC) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $<
200+
stdlib__%.cmi:
201+
$(CAMLC) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $(filter %.mli, $^)
205202

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

209-
stdlib__%.cmo: %.ml
210-
$(CAMLC) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $<
206+
stdlib__%.cmo:
207+
$(CAMLC) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $(filter %.ml, $^)
211208

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

215-
stdlib__%.cmx: %.ml
212+
stdlib__%.cmx:
216213
$(CAMLOPT) $(COMPFLAGS) $(OPTCOMPFLAGS) $(shell ./Compflags $@) \
217-
-o $@ -c $<
214+
-o $@ -c $(filter %.ml, $^)
218215

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

237+
RAW_OBJS=$(addsuffix .cmo,$(STDLIB_DEP_MODULES))
238+
PREFIXED_OBJS=$(filter stdlib__%.cmo,$(RAW_OBJS))
239+
UNPREFIXED_OBJS=$(PREFIXED_OBJS:stdlib__%.cmo=%)
240+
UNPREFIXED_OBJS_DISJUNCTION=${subst ${SPACE},|,${UNPREFIXED_OBJS}}
241+
240242
.PHONY: depend
241243
depend:
242244
$(CAMLDEP) $(DEPFLAGS) $(filter-out stdlib.%,$(wildcard *.mli *.ml)) \
243245
> .depend.tmp
244246
$(CAMLDEP) $(DEPFLAGS) -pp "$(AWK) -f ./remove_module_aliases.awk" \
245247
stdlib.ml stdlib.mli >> .depend.tmp
246248
sed -Ee \
247-
's#(^| )(${subst ${SPACE},|,${UNPREFIXED_OBJS}})[.]#\1stdlib__\2.#g' \
249+
's#(^| )(${UNPREFIXED_OBJS_DISJUNCTION})[.]#\1stdlib__\u\2.#g' \
250+
-e 's/^stdlib__(.)(.*)(\.[^i]*)(i?) :/stdlib__\1\2\3\4 : \l\1\2.ml\4/' \
248251
.depend.tmp > .depend
249252
rm -f .depend.tmp

stdlib/StdlibModules

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
# add stdlib__ as prefix to a module except for internal modules
2626
# and the stdlib module itself
2727
define add_stdlib_prefix
28-
$(or $(filter stdlib camlinternal%,$1), stdlib__$1)
28+
$(or $(filter stdlib camlinternal%,$1),\
29+
stdlib__$(shell echo $1 | cut -c1 | tr '[:lower:]' '[:upper:]')$\
30+
$(shell echo $1 | cut -c2-))
31+
endef
32+
define add_stdlib_dep_prefix
33+
$(or $(filter stdlib camlinternal%,$1),stdlib__$1)
2934
endef
3035

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

43-
STDLIB_MODULES=\
48+
STDLIB_MODULES:=\
4449
$(foreach module, $(STDLIB_MODS), $(call add_stdlib_prefix,$(module)))
50+
STDLIB_DEP_MODULES:=\
51+
$(foreach module, $(STDLIB_MODS), $(call add_stdlib_dep_prefix,$(module)))

stdlib/expand_module_aliases.awk

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ NR == 1 { printf ("# 1 \"%s\"\n", FILENAME) }
2424
state=2;
2525
else if ($1 == "module")
2626
{ if (ocamldoc!="true") printf("\n(** @canonical %s *)", $2);
27-
first_letter=substr($4,1,1);
28-
if (dune_wrapped!="true")
29-
first_letter=tolower(first_letter);
30-
printf("\nmodule %s = Stdlib__%s%s\n", $2, first_letter, substr($4,2));
27+
printf("\nmodule %s = Stdlib__%s\n", $2, $4);
3128
}
3229
else
3330
print

testsuite/tests/backtrace/backtrace2.reference

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, char
4242
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
4343
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
4444
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 38, characters 6-11
45-
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
45+
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
4646
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 9-42
4747
Re-raised at Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 61-70
4848
Called from Backtrace2.run in file "backtrace2.ml", line 62, characters 11-23
@@ -54,11 +54,11 @@ Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, char
5454
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
5555
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
5656
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 38, characters 6-11
57-
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
57+
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
5858
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 9-42
5959
Re-raised at Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 61-70
6060
Called from Backtrace2.run in file "backtrace2.ml", line 62, characters 11-23
61-
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
61+
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
6262
Called from Backtrace2.test_lazy.exception_raised_internally in file "backtrace2.ml", line 50, characters 8-41
6363
Re-raised at Backtrace2.test_lazy.aux in file "backtrace2.ml", line 47, characters 18-33
6464
Called from Backtrace2.test_lazy.aux in file "backtrace2.ml", line 47, characters 43-52
@@ -77,11 +77,11 @@ Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, char
7777
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
7878
Called from Backtrace2.test_Not_found.aux in file "backtrace2.ml", line 36, characters 43-52
7979
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 38, characters 6-11
80-
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
80+
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
8181
Called from Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 9-42
8282
Re-raised at Backtrace2.test_Not_found in file "backtrace2.ml", line 43, characters 61-70
8383
Called from Backtrace2.run in file "backtrace2.ml", line 62, characters 11-23
84-
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
84+
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
8585
Called from Backtrace2.test_lazy.exception_raised_internally in file "backtrace2.ml", line 50, characters 8-41
8686
Re-raised at Backtrace2.test_lazy.aux in file "backtrace2.ml", line 47, characters 18-33
8787
Called from Backtrace2.test_lazy.aux in file "backtrace2.ml", line 47, characters 43-52
@@ -92,7 +92,7 @@ Called from Backtrace2.test_lazy.aux in file "backtrace2.ml", line 47, character
9292
Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml", line 31, characters 17-27
9393
Re-raised at CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml", line 36, characters 4-11
9494
Called from Backtrace2.run in file "backtrace2.ml", line 62, characters 11-23
95-
Re-raised at Stdlib__hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
95+
Re-raised at Stdlib__Hashtbl.find in file "hashtbl.ml", line 539, characters 13-28
9696
Called from Backtrace2.test_lazy.exception_raised_internally in file "backtrace2.ml", line 50, characters 8-41
9797
Re-raised at CamlinternalLazy.force_lazy_block.(fun) in file "camlinternalLazy.ml", line 35, characters 56-63
9898
Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml", line 31, characters 17-27

testsuite/tests/lib-dynlink-initializers/test10_main.byte.reference

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Called from Test10_plugin in file "test10_plugin.ml", line 10, characters 2-6
66
Called from Dynlink.Bytecode.run in file "otherlibs/dynlink/dynlink.ml", line 137, characters 16-25
77
Re-raised at Dynlink.Bytecode.run in file "otherlibs/dynlink/dynlink.ml", line 139, characters 6-137
88
Called from Dynlink_common.Make.load.(fun) in file "otherlibs/dynlink/dynlink_common.ml", line 347, characters 13-44
9-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
9+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
1010
Called from Dynlink_common.Make.load in file "otherlibs/dynlink/dynlink_common.ml", line 345, characters 8-240
1111
Re-raised at Dynlink_common.Make.load in file "otherlibs/dynlink/dynlink_common.ml", line 355, characters 8-17
1212
Called from Test10_main in file "test10_main.ml", line 51, characters 13-69

testsuite/tests/lib-dynlink-initializers/test10_main.native.reference

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Called from Test10_plugin in file "test10_plugin.ml", line 10, characters 2-6
55
Called from Dynlink.Native.run.(fun) in file "otherlibs/dynlink/native/dynlink.ml", line 85, characters 12-29
66
Called from Dynlink.Native.run.(fun) in file "otherlibs/dynlink/native/dynlink.ml", line 85, characters 12-29
77
Re-raised at Dynlink.Native.run.(fun) in file "otherlibs/dynlink/native/dynlink.ml", line 87, characters 10-149
8-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
8+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
99
Called from Dynlink_common.Make.load.(fun) in file "otherlibs/dynlink/dynlink_common.ml", line 347, characters 13-44
10-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
10+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
1111
Called from Dynlink_common.Make.load in file "otherlibs/dynlink/dynlink_common.ml", line 345, characters 8-240
1212
Re-raised at Dynlink_common.Make.load in file "otherlibs/dynlink/dynlink_common.ml", line 355, characters 8-17
1313
Called from Dynlink_common.Make.loadfile in file "otherlibs/dynlink/dynlink_common.ml" (inlined), line 357, characters 26-45
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
11
-----------
22
Raised by primitive operation at Callstacks.alloc_list_literal in file "callstacks.ml", line 18, characters 30-53
33
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
4-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
4+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
55
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
66
-----------
77
Raised by primitive operation at Callstacks.alloc_pair in file "callstacks.ml", line 21, characters 30-76
88
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
9-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
9+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
1010
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
1111
-----------
1212
Raised by primitive operation at Callstacks.alloc_record in file "callstacks.ml", line 26, characters 12-66
1313
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
14-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
14+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
1515
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
1616
-----------
1717
Raised by primitive operation at Callstacks.alloc_some in file "callstacks.ml", line 29, characters 30-60
1818
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
19-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
19+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
2020
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
2121
-----------
2222
Raised by primitive operation at Callstacks.alloc_array_literal in file "callstacks.ml", line 32, characters 30-55
2323
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
24-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
24+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
2525
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
2626
-----------
2727
Raised by primitive operation at Callstacks.alloc_float_array_literal in file "callstacks.ml", line 36, characters 12-62
2828
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
29-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
29+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
3030
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
3131
-----------
3232
Raised by primitive operation at Callstacks.do_alloc_unknown_array_literal in file "callstacks.ml", line 39, characters 22-27
3333
Called from Callstacks.alloc_unknown_array_literal in file "callstacks.ml", line 41, characters 30-65
3434
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
35-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
35+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
3636
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
3737
-----------
3838
Raised by primitive operation at Callstacks.alloc_small_array in file "callstacks.ml", line 44, characters 30-69
3939
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
40-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
40+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
4141
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
4242
-----------
4343
Raised by primitive operation at Callstacks.alloc_large_array in file "callstacks.ml", line 47, characters 30-73
4444
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
45-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
45+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
4646
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
4747
-----------
4848
Raised by primitive operation at Callstacks.alloc_closure.(fun) in file "callstacks.ml", line 51, characters 30-43
4949
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
50-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
50+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
5151
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
5252
-----------
5353
Raised by primitive operation at Callstacks.get0 in file "callstacks.ml", line 54, characters 28-33
5454
Called from Callstacks.getfloatfield in file "callstacks.ml", line 56, characters 30-47
5555
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
56-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
56+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
5757
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
5858
-----------
59-
Raised by primitive operation at Stdlib__marshal.from_bytes in file "marshal.ml", line 61, characters 9-35
59+
Raised by primitive operation at Stdlib__Marshal.from_bytes in file "marshal.ml", line 61, characters 9-35
6060
Called from Callstacks.alloc_unmarshal in file "callstacks.ml", line 62, characters 12-87
6161
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
62-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
62+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
6363
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
6464
-----------
6565
Raised by primitive operation at Callstacks.alloc_ref in file "callstacks.ml", line 65, characters 30-59
6666
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
67-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
67+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
6868
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27
6969
-----------
7070
Raised by primitive operation at Callstacks.prod_floats in file "callstacks.ml", line 68, characters 37-43
7171
Called from Callstacks.alloc_boxedfloat in file "callstacks.ml", line 70, characters 30-49
7272
Called from Callstacks.test in file "callstacks.ml", line 92, characters 2-10
73-
Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
73+
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
7474
Called from Callstacks in file "callstacks.ml", line 99, characters 2-27

0 commit comments

Comments
 (0)