Skip to content

Commit

Permalink
Merge branch '4.14' into fp_exn_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
gasche committed Feb 22, 2022
2 parents 31ca227 + ddf9978 commit a6369a2
Show file tree
Hide file tree
Showing 47 changed files with 418 additions and 277 deletions.
18 changes: 18 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ OCaml 4.14.0
- #10281, #10685: Add description of C compiler on macOS and Windows platforms.
(Dong An, review by Xavier Leroy and David Allsopp)

- #10397: Document exceptions raised by Unix module functions on Windows
(Martin Jambon, review by Daniel Bünzli, David Alsopp, Damien Doligez,
Xavier Leroy, and Florian Angeletti)

- #10589: Fix many typos (excess/inconsistent spaces) in the HTML manual.
(Wiktor Kuchta, review by Florian Angeletti)

Expand Down Expand Up @@ -259,6 +263,9 @@ OCaml 4.14.0
spurious `as 'a`s in types.
(Antal Spector-Zabusky, review by Florian Angeletti)

- #10794: Clarify warning 57 (Ambiguous or-pattern variables under guard)
(Wiktor Kuchta, review by Gabriel Scherer)

### Internal/compiler-libs changes:

- #1599: add unset directive to ocamltest to clear environment variables before
Expand Down Expand Up @@ -378,6 +385,11 @@ OCaml 4.14.0
- #10828 Build native-code compilers on OpenBSD/aarch64
(Christopher Zimmermann)

- #10835 Disable DT_TEXTREL warnings on x86 32 bit architecture by passing
-Wl,-z,notext in mksharedlib and mkmaindll. Fixes relocation issues, reported
in #9800, making local patches in Debian, Alpine, and FreeBSD superfluous.
(Hannes Mehnert with Kate Deplaix and Stéphane Glondu, review by Xavier Leroy)

- #10717: Simplify the installation of man pages
(Sébastien Hinderer, review by David Allsopp)

Expand Down Expand Up @@ -465,6 +477,12 @@ OCaml 4.14.0
- #10907, #10959: Wrong type inferred from existential types
(Jacques Garrigue and Gabriel Scherer, report by @dyzsr, review by Leo White)

- #10688: Move frame descriptor table from `rodata` to `data` section on
RISC-V. Improves support for building DLLs and PIEs. In particular, this
applies to all binaries in distributions that build PIEs by default (eg
Gentoo and Alpine).
(Alex Fan, review by Gabriel Scherer)

- #11031: Exception handlers restore the rbp register when using frame-pointers
on amd64.
(Fabrice Buoro, with help from Stephen Dolan, Tom Kelly and Mark Shinwell,
Expand Down
5 changes: 4 additions & 1 deletion HACKING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ result by running
make html_doc
----

and then opening link:./api_docgen/build/html/libref/index.html[] in a web browser.
and then opening link:./api_docgen/ocamldoc/build/html/libref/index.html[] in a web browser.
The documentation is located in
link:./api_docgen/odoc/build/html/libref/index.html[] when `--with-odoc` is
passed to the configure script.

=== Tools

Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,6 @@ partialclean::
.PHONY: html_doc
html_doc: ocamldoc
$(MAKE) -C api_docgen html
@echo "documentation is in ./api_docgen/html/"

.PHONY: manpages
manpages:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
4.14.0+dev6-2022-02-08
4.14.0+dev8-2022-02-21

# Starting with OCaml 4.14, although the version string that appears above is
# still correct and this file can thus still be used to figure it out,
Expand Down
55 changes: 29 additions & 26 deletions api_docgen/Format_tutorial.mld
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{0 Using the Format module}

{1 Principles}

Line breaking is based on three concepts:
Expand Down Expand Up @@ -37,22 +39,21 @@ There are 4 types of boxes. (The most often used is the "hov" box type, so skip
the rest at first reading).

- {b horizontal box} ({i h} box, as obtained by the
{!open_hbox} procedure): within this box, break hints do not
{!Format.open_hbox} procedure): within this box, break hints do not
lead to line breaks.
- {b vertical box} ({i v} box, as obtained by the
{!open_vbox} procedure): within this box, every break hint lead
{!Format.open_vbox} procedure): within this box, every break hint lead
to a new line.
- {b vertical/horizontal box} ({i hv} box, as obtained by
the {!open_hvbox} procedure): if it is possible, the entire box
the {!Format.open_hvbox} procedure): if it is possible, the entire box
is written on a single line; otherwise, every break hint within the box
leads to a new line.
- {b vertical or horizontal box} ({i hov} box, as obtained
by the {!open_box} or {!open_hovbox} procedures): within this box, break
hints are used to cut the line when there is no more room on the line.
There are two kinds of "hov" boxes, you can find the details
below. In first approximation, let me
consider these two kinds of "hov" boxes as equivalent and
obtained by calling the {!open_box} procedure.
by the {!Format.open_box} or {!Format.open_hovbox} procedures): within this
box, break hints are used to cut the line when there is no more room on the
line. There are two kinds of "hov" boxes, you can find the details below.
In first approximation, let me consider these two kinds of "hov" boxes as
equivalent and obtained by calling the {!Format.open_box} procedure.

Let me give an example. Suppose we can write 10 chars before
the right margin (that indicates no more room). We represent any
Expand Down Expand Up @@ -216,13 +217,14 @@ indentation (as obtained by [open_hovbox 1]), and b is [print_break 1 2], then
The "hov" box type is refined into two categories.

- {b the vertical or horizontal {i packing} box} (as obtained by the
{!open_hovbox} procedure): break hints are used to cut the line when there is no
more room on the line; no new line occurs if there is enough room on the line.
- {b vertical or horizontal {i structural} box} (as obtained by the {!open_box}
procedure): similar to the "hov" packing box, the break hints are used to cut
the line when there is no more room on the line; in addition, break hints that
can show the box structure lead to new lines even if there is enough room on
the current line.
{!Format.open_hovbox} procedure): break hints are used to cut the line when
there is no more room on the line; no new line occurs if there is enough room
on the line.
- {b vertical or horizontal {i structural} box} (as obtained by the
{!Format.open_box} procedure): similar to the "hov" packing box, the break
hints are used to cut the line when there is no more room on the line; in
addition, break hints that can show the box structure lead to new lines even if
there is enough room on the current line.

The difference between a packing and a structural "hov" box is shown by a
routine that closes boxes and parentheses at the end of printing: with packing
Expand All @@ -231,17 +233,18 @@ is enough room on the line, whereas with structural boxes each break hint will
lead to a new line. For instance, when printing
"\[(---\[(----\[(---b)\]b)\]b)\]", where "b" is a break hint without extra
indentation ([print_cut ()]). If "\[" means opening of a packing "hov" box
({!open_hovbox}), "\[(---\[(----\[(---b)\]b)\]b)\]" is printed as follows:
({!Format.open_hovbox}), "\[(---\[(----\[(---b)\]b)\]b)\]" is printed as
follows:

{[
(---
(----
(---)))
]}

If we replace the packing boxes by structural boxes ({!open_box}), each break
hint that precedes a closing parenthesis can show the boxes structure, if it
leads to a new line; hence "\[(---\[(----\[(---b)\]b)\]b)\]" is printed like
If we replace the packing boxes by structural boxes ({!Format.open_box}), each
break hint that precedes a closing parenthesis can show the boxes structure, if
it leads to a new line; hence "\[(---\[(----\[(---b)\]b)\]b)\]" is printed like
this:

{[
Expand All @@ -257,8 +260,8 @@ this:

When writing a pretty-printing routine, follow these simple rules:

+ Boxes must be opened and closed consistently ([open_*] and {!close_box} must
be nested like parentheses).
+ Boxes must be opened and closed consistently ([open_*] and
{!Format.close_box} must be nested like parentheses).
+ Never hesitate to open a box.
+ Output many break hints, otherwise the pretty-printer is in a bad situation
where it tries to do its best, which is always "worse than your bad".
Expand All @@ -275,10 +278,10 @@ is a usual (and elegant) way to indent the expression part of a definition. In
short, it is often necessary to print unbreakable spaces; however, most of the
time a space should be considered a break hint.
+ Do not try to force new lines, let the pretty-printer do it for you: that's
its only job. In particular, do not use {!force_newline}: this procedure
effectively leads to a newline, but it also as the unfortunate side effect to
partially reinitialise the pretty-printing engine, so that the rest of the
printing material is noticeably messed up.
its only job. In particular, do not use {!Format.force_newline}: this
procedure effectively leads to a newline, but it also as the unfortunate side
effect to partially reinitialise the pretty-printing engine, so that the rest
of the printing material is noticeably messed up.
+ Never put newline characters directly in the strings to be printed: pretty
printing engine will consider this newline character as any other character
written on the current line and this will completely mess up the output.
Expand Down
35 changes: 26 additions & 9 deletions api_docgen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,37 @@
#* special exception on linking described in the file LICENSE. *
#* *
#**************************************************************************
# Used by included Makefiles
ROOTDIR = ..
-include $(ROOTDIR)/Makefile.build_config

ifeq ($(DOCUMENTATION_TOOL),odoc)
include odoc/Makefile
else
include ocamldoc/Makefile
endif
-include ../Makefile.build_config

odoc-%:
$(MAKE) -C odoc $* ROOTDIR=../..
$(MAKE) -C odoc $*

ocamldoc-%:
$(MAKE) -C ocamldoc $* ROOTDIR=../..
$(MAKE) -C ocamldoc $*

ifeq ($(DOCUMENTATION_TOOL),odoc)
man: odoc-man
latex: odoc-latex
html: odoc-html
@echo "documentation is in ./api_docgen/odoc/build/html/"
all: html latex man
install: odoc-install
else
man: ocamldoc-man
latex: ocamldoc-latex
html: ocamldoc-html
@echo "documentation is in ./api_docgen/ocamldoc/build/html/"
texi: ocamldoc-texi
pdf: ocamldoc-pdf
all: html pdf man latex texi
install: ocamldoc-install
endif

clean:
rm -rf build odoc/build ocamldoc/build

distclean: clean

.PHONY: html latex man clean distclean install texi pdf
8 changes: 3 additions & 5 deletions api_docgen/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#* special exception on linking described in the file LICENSE. *
#* *
#**************************************************************************
ROOTDIR = ..
DOCGEN= $(ROOTDIR)/api_docgen

include $(ROOTDIR)/Makefile.common
Expand All @@ -30,7 +29,7 @@ DOC_STDLIB_DIRS = $(addprefix $(ROOTDIR)/, stdlib \
.PHONY: all
all: html pdf man

DIRS = $(addprefix build/,libref compilerlibref man latex texi \
DIRS = build/ $(addprefix build/,libref compilerlibref man latex texi \
html html/libref html/compilerlibref)

$(DIRS):
Expand All @@ -43,14 +42,13 @@ html:
build/latex/alldoc.pdf: build/latex/stdlib_input.tex \
build/latex/compilerlibs_input.tex | build/latex/ifocamldoc.tex

$(DOCGEN)/build/Compiler_libs.mld: $(DOCGEN)/Compiler_libs.pre.mld
build/Compiler_libs.mld: $(DOCGEN)/Compiler_libs.pre.mld | build/
cp $< $@ && echo "{!modules:$(compilerlibref_C)}" >> $@

build/latex/ifocamldoc.tex: $(ROOTDIR)/Makefile.config | build/latex

build/latex/alldoc.tex:$(DOCGEN)/alldoc.tex | build/latex
cp $< $@

$(compilerlibref_TEXT:%=build/%.mld) $(libref_TEXT:%=build/%.mld): \
build/%.mld:$(DOCGEN)/%.mld
build/%.mld: $(DOCGEN)/%.mld | build/
cp $< $@
2 changes: 1 addition & 1 deletion api_docgen/Ocaml_operators.mld
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Precedence level and associativity of operators
{0 Precedence level and associativity of operators}

The following table lists the precedence level of all operator classes
from the highest to the lowest precedence. A few other syntactic constructions
Expand Down
22 changes: 12 additions & 10 deletions api_docgen/ocamldoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
#* special exception on linking described in the file LICENSE. *
#* *
#**************************************************************************
include $(ROOTDIR)/api_docgen/Makefile.common
include $(ROOTDIR)/ocamldoc/Makefile.best_ocamldoc
vpath %.mli $(ROOTDIR)/stdlib $(DOC_COMPILERLIBS_DIRS) $(DOC_STDLIB_DIRS)
# Used by included Makefiles
ROOTDIR = ../..
include ../Makefile.common
include ../../ocamldoc/Makefile.best_ocamldoc
vpath %.mli ../../stdlib $(DOC_COMPILERLIBS_DIRS) $(DOC_STDLIB_DIRS)


man: build/man/Stdlib.3o
Expand All @@ -36,12 +38,12 @@ ALL_MAN= $(ALL_DOC:%=build/man/%.3o)
ALL_LATEX= $(ALL_DOC:%=build/latex/%.tex)

build/latex/ifocamldoc.tex: | build/latex
printf '\\newif\ifocamldoc\ocamldoctrue\n' > $@
printf '\\newif\\ifocamldoc\\ocamldoctrue\n' > $@

$(libref:%=build/libref/%.odoc): build/libref/%.odoc: %.mli | build/libref
$(OCAMLDOC_RUN) -nostdlib -hide Stdlib -lib Stdlib \
-pp \
"$(AWK) -v ocamldoc=true -f $(ROOTDIR)/stdlib/expand_module_aliases.awk" \
"$(AWK) -v ocamldoc=true -f ../../stdlib/expand_module_aliases.awk" \
$(DOC_STDLIB_INCLUDES) $< -dump $@

$(compilerlibref:%=build/compilerlibref/%.odoc):\
Expand All @@ -50,11 +52,11 @@ build/compilerlibref/%.odoc: %.mli | build/compilerlibref
$(DOC_ALL_INCLUDES) $< -dump $@

$(compilerlibref_TEXT:%=build/compilerlibref/%.odoc):\
build/compilerlibref/%.odoc: $(DOCGEN)/build/%.mld | build/compilerlibref
build/compilerlibref/%.odoc: build/%.mld | build/compilerlibref
$(OCAMLDOC_RUN) $(DOC_ALL_INCLUDES) -text $< -dump $@

$(libref_TEXT:%=build/libref/%.odoc):\
build/libref/%.odoc: $(DOCGEN)/%.mld | build/libref
build/libref/%.odoc: build/%.mld | build/libref
$(OCAMLDOC_RUN) $(DOC_STDLIB_INCLUDES) -text $< -dump $@

ALL_COMPILED_DOC=$(ALL_DOC:%=build/%.odoc)
Expand All @@ -76,7 +78,7 @@ build/html/compilerlibref/Compiler_libs.html: \
$(OCAMLDOC_RUN) -html -d build/html/compilerlibref \
-nostdlib -hide Stdlib -t "OCaml compiler library" \
$(HTML_OPTIONS) \
-intro $(DOCGEN)/build/Compiler_libs.mld \
-intro build/Compiler_libs.mld \
$(addprefix -load , $(ALL_COMPILERLIBREF:%=build/%.odoc))

build/texi/stdlib.texi: $(ALL_COMPILED_DOC) | build/texi
Expand All @@ -100,9 +102,9 @@ build/latex/Stdlib.tex: $(ALL_COMPILED_DOC) | build/latex
build/latex/alldoc.pdf: build/latex/Stdlib.tex build/latex/alldoc.tex \
| build/latex
cd build/latex && \
TEXINPUTS=$${TEXINPUTS}:$(ROOTDIR)/ocamldoc pdflatex alldoc
TEXINPUTS=$${TEXINPUTS}:../../ocamldoc pdflatex alldoc
cd build/latex && \
TEXINPUTS=$${TEXINPUTS}:$(ROOTDIR)/ocamldoc pdflatex alldoc
TEXINPUTS=$${TEXINPUTS}:../../ocamldoc pdflatex alldoc

stdlib_INPUT=$(foreach module,\
$(filter-out stdlib.mli camlinternal%,$(stdlib_UNPREFIXED)),\
Expand Down

0 comments on commit a6369a2

Please sign in to comment.