Commit Graph

707 Commits (001c2d12836f9c5d3b688af1f83412d39a9be195)

Author SHA1 Message Date
Xavier Clerc 9c182f7e24 Add -dcamlprimc + pass -fdebug-prefix-map when available (#1845)
- Introduce `-dcamlprimc`, to keep the generated C file containing the primitive list
- Use `-fdebug-prefix-map` for compiling temporary C files when this option is supported
2018-06-27 14:56:29 +01:00
Florian Angeletti 349db3d869
PR#6416 et al.: injective mapping between identifiers and printed names (#1120) 2018-06-26 22:03:45 +02:00
Gabriel Scherer f3aca2376f
Merge pull request #1821 from gasche/makefiles-consistent-opt-targets
Makefiles: consistently offer `allopt` and `opt.opt` targets
2018-06-24 00:46:50 +02:00
Gabriel Scherer feb27cfd94 make alldepend 2018-06-19 15:00:22 +02:00
David Allsopp b5d1929e87 Whitespace and overlong line fixes. 2018-06-14 15:15:34 +01:00
David Allsopp bfae3a032c Correct copyright headers in ocamldoc 2018-06-13 09:37:49 +01:00
Gabriel Scherer a1bc562d8a makefiles: consistently offer *both* 'allopt' and 'opt.opt' targets
Some makefiles (lex, stdlib, otherlibs) would only offer allopt, while
others (ocamldoc, tools) only offered opt.opt. It is inconvenient to
have to remember which target name to use while going through various
repositories.
2018-06-07 09:54:13 +02:00
Sébastien Hinderer a2586680a0 Remove the Makefile.nt files 2018-05-25 00:36:56 +02:00
Thomas Refis e63e8421a1 move Rec_check out of typecore 2018-05-23 10:53:53 +01:00
Mark Shinwell ea2d6a1e31
Add configure options to control installation of source artifacts (#1777) 2018-05-14 08:15:44 +01:00
Thomas Refis dcf11ea4ca
Merge pull request #1705 from hhugo/exn
keep @@ attributes on exceptions
2018-04-27 11:16:41 +01:00
Damien Doligez dc649712b6 fix grammar conflicts in ocamldoc 2018-04-20 15:42:59 +02:00
Florian Angeletti c5b3dada13 cleanup stdlib documentation makefiles (#1700) 2018-04-12 11:02:16 +01:00
Gabriel Scherer 57f086ed06
Merge pull request #1710 from gasche/man-superscript
ocamldoc: improve printing of subscript/superscript in 'man' format
2018-04-11 17:20:52 +02:00
Gabriel Scherer b5391c911c ocamldoc Makefile: change target names to avoid useless recompilation
The target names for the 'man' and 'html' files are
  stdlib_{html,man}/Stdlib.{3o,html}
but these files are never produced by the corresponding rules,
so the rule is re-run on each "make world.opt".

This patch changes these target names to Pervasives.{3o,html}, which
is an actual file produced by the build. It is not fully clear to me
whether the authors of the original rule intended to also produced
documentation for a joint Stdlib module.

Before this patch, running "make world.opt" in an already-built directory
would take 10s on my machine. Now it takes 2s.

(no change entry needed)
2018-04-11 13:30:48 +02:00
Hugo Heuzard 002815c4bb allow to attach @@ attributes on exceptions 2018-04-09 22:29:46 +01:00
Gabriel Scherer afd6430283 ocamldoc: improve printing of subscript/superscript in 'man' format
On a standard OCaml install, `man Nativeint` shows the following
sentence in its first paragraph:

    All arithmetic operations over nativeint are taken
    modulo 2^{32 or 2^{64 depending on the word size of the architecture.

The `2^{32` is a rendering bug. This PR removes the unbalanced curvy
bracket, so it prints 2^32 and 2^64 instead.

In theory just printing ^ and _ risks creating ambiguities for
multi-words superscripts or subscripts: "2^foo bar" could be either
"2^{foo bar}" or "2^{foo} bar". In practice, the ocamldoc text in the
standard library only uses the superscript for bit sizes.

Even for arbitrary user documentation comments, "^{" or "^" have the
same property of not being explicit about where the superscript ends,
so this would not be a regression even on multi-word superscripts.
2018-04-09 17:54:23 +02:00
Mark Shinwell 5e5457769f make alldepend 2018-04-09 14:44:14 +01:00
Jérémie Dimino 32da45a80a Move bigarray to the stdlib (#1685) 2018-04-09 13:14:05 +01:00
Gabriel Radanne b073f825de Make Ident.t abstract and immutable. (#1704) 2018-04-09 10:19:23 +01:00
Gabriel Scherer 3702f53692 factorize common makefile definitions in Makefile.common 2018-03-29 17:04:05 +02:00
Gabriel Scherer afcd29eb0c makefiles: turn the 'install' command into a variable
(Suggestion made by Sébastien Hinderer during review.)
2018-03-29 14:40:23 +02:00
Gabriel Scherer e08bb1057a ocamldoc/Makefile: rename variables for consistency 2018-03-29 14:40:23 +02:00
Gabriel Scherer ecfd39f127 makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.

¹: a brtfs filesystem on an old-ish SSD

Why I care
----------

An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.

Partial diagnosis
-----------------

The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.

Change
------

The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).

Testing
-------

I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.

Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:

    for f in $(find $DESTDIR); do \
      echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
    done | sort

Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-29 14:40:22 +02:00
Florian Angeletti 02326ad0f4
Merge pull request #1662 from Octachron/ocamldoc_nostdlib
ocamldoc: honour nostdlib flag
2018-03-17 02:02:19 +01:00
octachron c68da34001 ocamldoc: honour the -nostdlib flag 2018-03-17 00:51:38 +01:00
Simon Cruanes df80f34a92 Stdlib functional iterators (#1002)
* add `Seq` module, expose iterator conversions in most containers

* small typo

* typo

* change order of arguments for `{Map,Set}.add_seq`

* watch for max string length in `Bytes.of_seq`

* wip: make it build again

* Fix dependency

Sys needs to be linked before Bytes in stdlib.

* Update threads/stdlib.ml

* Update stdlib_no_prefixed/.depend

* fix inconsistencies with label modules

* update testsuite to work with seq

* update change file

* small change in `Hashtbl.to_seq`, capturing only the underlying array

* add some documentation to seq.mli

* revert to good ol' module type names for hashtables

* fix test

* change style of comments in seq.mli

* follow some demands in review of GPR #1002

* some fixes for #1002

* add Seq-related functions to Ephemeron

* add some comments on `Hashtbl.of_seq`

* add more tests for `Hashtbl.{to,of}_seq`

* fix bug in `Ephemeron.to_seq`

* Update Changes
2018-03-16 18:25:10 +01:00
Nicolás Ojeda Bär 242b6f20a1 make depend 2018-03-15 18:26:51 +01:00
octachron 4583eb1a05 ocamldoc, html: add end line to please AppVeyor 2018-03-06 11:58:10 +01:00
objmagic 0993cd9ba9 Support empty variants (#1546)
* Allow empty variants.
* Update manual and ocamldoc.
2018-03-06 10:48:16 +09:00
Gabriel Scherer 0489cfaf9e build_path_prefix_map: update .depend and Makefiles 2018-03-01 17:41:28 +01:00
Thomas Refis 3edeed67d4 add a scope field to type_expr 2018-02-27 14:52:23 +00:00
Sébastien Hinderer fa7019437c Add the -dunique-ids and -dno-unique-ids options to the compilers
These options allow to control whether identifiers are made unique by
appending a stamp to them when dumping intermediate representations or not.

The default is to print the stamp, as is done currently.

The "-dno-unique-ids" option is useful e.g. to simplify the comparison
between a produced intermediate reprsentation (-dlambda, say) and the
expected one, in the context of the testsuite, for instance.
2018-02-20 18:02:35 +01:00
Jeremie Dimino 994debc18b s/make/$(MAKE)/ in ocamldoc/Makefile.unprefix 2018-02-13 10:42:18 +00:00
Jeremie Dimino 84304a3282 Core review work
- Apply the __ heuristic more systematically
- Update tests
- Fix Windows builds
2018-02-12 08:29:17 +00:00
octachron 8f2a15369f Factorize the build of the unprefixed stdlib
which is used by both ocamldoc and the reference manual.
2018-02-12 08:29:16 +00:00
octachron e95b0c4769 Minimal fix for the manual build pocess 2018-02-12 08:29:16 +00:00
David Allsopp 5e35fd0418 Alter awk scripts to cope with CRLF checkout 2018-02-12 08:29:16 +00:00
David Allsopp 4d79045d95 Use gawk on Windows in the build system
awk is symbolic link in Cygwin, which means it can't be used in -pp for
a native Windows build. Just use gawk instead, as no other package
provides the awk command on Cygwin.
2018-02-12 08:29:16 +00:00
Jeremie Dimino 225d1c65b9 Prefix the compilation unit names of all modules in the stdlib
Except for the Camlinternal* modules and the new Stdlib module, all
modules in the stdlib now compile to Stdlib__<module>.

Pervasives is renamed to Stdlib and now contains a list of aliases
from the long names to the short ones, so that from inside and outside
the stdlib we can refer to the standard modules as just List or
Stdlib.List rather than Stdlib__list.

In order to avoid printing the long names in error messages and in the
toplevel, the following heuristic is added to Printtyp: given a path
Foo__bar, if Foo.Bar exists and is a direct or indirect alias to
Foo__bar, then prefer Foo.Bar.

A bootstrap step was required to replace Pervasives by Stdlib as the
module opened by default.
2018-02-12 08:29:16 +00:00
Gabriel Scherer cc5b7ef6be make alldepend 2018-02-05 19:30:48 +01:00
Jérémie Dimino 49f6dd5d20
Allow compilation units to shadow sub-modules of Pervasives (#1513) 2018-02-02 10:44:23 +00:00
Florian Angeletti c0ded0eabe Ocamldoc, latex backend: labels for exception (#1457)
This commit fixes the lack of label for exception definition in the latex
backend of ocamldoc.
2017-10-28 21:07:32 +02:00
Xavier Leroy 875ff82841 MPR#7048: ocamldoc -latex, don't escape Latin-1 accented letters (GPR#1420)
This causes trouble when the doc comments are actually in UTF8 and
the user is providing their own preamble with an UTF8 inputenc.

The default preamble still contains \usepackage[latin1]{inputenc},
so the Latin-1 accents will still display fine.
2017-10-09 19:18:28 +02:00
Xavier Leroy 801993dc8d GPR#931 follow-up: problem with remove_DEBUG sed script under OpenBSD
On OpenBSD this script removes the newline at the end of each line
that is transformed.  If the next line is a `# lineno "filename"`
directive, a syntax error occurs.

This commit changes the script to use a sed 's' command instead of a
'c' command.  This restores the expected behavior under OpenBSD and
seems to make no difference for other systems.
2017-10-07 15:52:07 +02:00
octachron 9c8ac99009 fix few documentation headers 2017-10-04 13:05:05 +02:00
octachron e5715c7bf5 PR#7363: add a texinfo title option to ocamldoc 2017-10-04 13:05:05 +02:00
octachron e30e82a219 PR#7363: start documentation headers at {1 2017-10-04 13:05:05 +02:00
octachron 03e1a93f0b PR#7363, ocamldoc: implicit level 0 for titles
This commit makes the heading hierarchy of ocamldoc start at {0 rather
than {1. This level {0 should be reserved for global titles, freeing
the use of {1 for normal subtitles.
2017-10-03 23:29:50 +02:00
Gabriel Scherer 6550a30719 safe-string: clarify the relation between configure- and compile-time options 2017-10-02 14:42:19 +02:00
octachron 9593af586f ocamldoc html: add missing id to signature items
This commit adds a new id to classes, modules and module types.
The class id replaces the preexisting name attribute that was intended
to be an id attribute.
2017-09-30 20:10:27 +02:00
Leo White 5cb27d8ebb Merge pull request #792 from sliquister/generalize-destr-subst2
Fixing the limitations on destructive substitutions
2017-09-15 09:29:29 +01:00
Xavier Leroy 967ff73a61 Remove otherlibs/num
Continuing a general effort, this commit removes the "num" library for arbitrary-precision arithmetic from the core OCaml system.  A standalone distribution of this library already exists and is hosted at https://github.com/ocaml/num
2017-08-19 10:03:00 +02:00
Fourchaux 72cfdd56e9 Typos and basic grammar error fixing (#1280) 2017-08-10 11:59:23 +01:00
Valentin Gatien-Baron 45f21c6d2b Teach Changes, ocamldoc and the manual about deep destructive substitutions 2017-08-01 07:40:14 -04:00
Valentin Gatien-Baron ff05023fde Support syntax: S with module M.N := .. 2017-08-01 07:40:01 -04:00
Valentin Gatien-Baron f29cd5ab6d Support syntax: S with M.N.t := ... 2017-08-01 07:32:08 -04:00
octachron e5f94ee9d4 Factorize first comment before elements code 2017-07-31 23:01:02 +02:00
octachron cc27e58ea2 PR#7478: ocamldoc, avoid module preambule repetion
To avoid module preamble repetition, ocamldoc only use as a module
preamble documentation comments that occur before any module elements,
which should also prevent some unexpected module preamble when the first
documentation comments appears in the middle of the source file.
2017-07-31 23:01:02 +02:00
Gabriel Scherer aa6b5b96a5 Merge pull request #1118 from objmagic/object-inherit
Support inherited field in object type expression
2017-07-28 07:47:53 +02:00
Olaf Hering aefcb6d777 MPR#7281: fix .TH macros in generated manpages
The troff .TH macro takes up to three extra args, according to the
groff documentation at gnu.org. ocamldoc inserts a fourth argument
"source:". Remove the extra argument. Fixes commit a87c3f20e
("Enable ocamldoc to build reproducible manpages")

Without this change the header/footer of each ocaml manpage is
broken. Example: the date should be in the middle of footer,
instead of the left side. The string "source:" should not be shown
at all. No other manpage has such string.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2017-07-24 16:40:43 +02:00
Runhang Li c39b975d43 merge trunk and update test 2017-07-23 09:31:58 +08:00
Alain Frisch fd47ba9649 Support 'let open' in class and class type expressions (#1249)
* Support 'let open' in class and class type expressions.

* Adapt ocamlprof.

* Adapt ocamldoc.

* Add tests.

* Changelog.

* Manual.
2017-07-20 08:17:30 +02:00
Runhang Li bc32e7a52d
Merge branch 'trunk' into object-inherit 2017-05-22 16:32:24 -07:00
Florian Angeletti a65ce51ace Ocamldoc: end latex files with a new line (#1159) 2017-05-04 15:26:10 +01:00
Sébastien Hinderer 40fcbb5f0a Move configuration header files from the config to the byterun/caml directory
This commit moves:
  - config/m.h to byterun/caml/m.h
  - config/s.h to byterun/caml/s.h

Consequently, m.h and s.h now get installed alongside other
OCaml header files.

This commit also updates the .depend files, introducing updates in the
dependencies which are not consequences of this commit itself.
2017-04-26 19:28:17 +02:00
octachron f7ed665b3c ocamldoc: avoid nested <pre> in module description 2017-04-04 13:27:45 +02:00
Runhang Li edfb8afb0e
Missing arrow. 2017-03-28 22:10:12 -07:00
Runhang Li f7283dafb0
Update ocamldoc tests
Also add test for polymorphic variants.
2017-03-28 21:49:36 -07:00
alainfrisch 0ab1339576 Fix ocamldoc. 2017-03-24 14:24:36 +01:00
Runhang Li 04f05bba64
Remove message. 2017-03-22 22:32:30 -07:00
Runhang Li 864b3b735e
Merge branch 'trunk' into object-inherit 2017-03-22 22:13:06 -07:00
Mark Li 9dc86f8417
Support inherited field in object type expression.
Also add location on object field label and polymorphic variant tags.
2017-03-22 21:47:34 -07:00
octachron d069dbe585 MPR#7352,7353: ocamldoc, better paragraphs in html 2017-03-15 19:55:37 +01:00
octachron 9d97673b9f PR#7351: ocamldoc html, use tags rather than <br>
This commit replaces most of the use of <br> tags in ocamldoc html
backend by more meaningful tags, in order to improve the themability
of the generated html code.
2017-03-15 15:26:56 +01:00
Pierre Boutillier bb27a9803b Ocamldoc: no -title, no empty <h1> in html 2017-03-12 13:35:16 -04:00
Sébastien Hinderer 9e81b0fb4b Update .depend files 2017-03-09 17:12:02 +01:00
Gabriel Scherer 13205fca1d Merge pull request #1085 from Octachron/ocamldoc_self_alias_loop
PR#7331: ocamldoc, avoid self-alias induced infinite loop
2017-03-08 07:49:23 -05:00
Gabriel Scherer 6e94a853de Merge pull request #862 from gasche/PR7037-input_name-in-Pparse
MPR#7037: fix erroneous Location.input_name setting in Pparse.file
2017-03-08 07:41:15 -05:00
sliquister 356d8a9c0c Changing the display of fatal warnings (#948) 2017-03-08 09:16:01 +00:00
Gabriel Scherer a62dd60dee Merge pull request #1040 from dhekir/trunk
fix several typos in comments
2017-02-22 20:26:50 -05:00
octachron 9fc48c62d3 PR#7488: wrong Latex output for variant types 2017-02-19 09:11:15 +00:00
octachron f6736c18ce Update ocamldoc .depend 2017-02-18 08:32:27 +01:00
octachron d377bce541 Update ocamldoc Makefile 2017-02-18 08:32:03 +01:00
Sébastien Hinderer 13c8c60f39 Update documentation and scripts to use Makefile even on Windows 2017-02-15 11:19:07 +01:00
Daniel b9dd14cdaf fix several typos in comments 2017-02-13 17:09:50 +01:00
octachron 9369c3515e ocamldoc:show missed cross-reference opportunities 2017-02-01 20:20:02 +01:00
Gabriel Scherer b7ccc16af2 ocamldoc: keep using relative instead of absolute source file names
The fact that ocamldoc uses absolute file paths in its error messages
creates a usability problem for ocamlbuild users that see the path of
the files in _build instead of the path of the files in the source
project. See <https://github.com/ocaml/ocamlbuild/issues/79>:

    cd /tmp
    mkdir repro; cd repro
    echo "(** hey {ol {1 bla}} *)" > a.mli
    echo "A" > doc.odocl
    ocamlbuild doc.docdir/index.html

raises the error message:

>     File "/tmp/repro/_build/a.mli", line 0, character 11:
>     Error parsing text:
>     hey {ol {1 bla}}
>                ^

and then people jump to the reported error site from their editor, and
then they are editing temporary _build files and it is a mess.

After the patch is applied, we get the following error message instead:

>     File "a.mli", line 0, character 11:
>     Error parsing text:
>     hey {ol {1 bla}}
>                ^

The code that is removed by the patch is also a mess, of undocumented
assumptions. It is careful to Sys.chdir to the argument's directory,
and to capture a long name there and Sys.chdir back. This would make
perfect sense if other parts of ocamldoc were also using 'chdir' and
one could therefore not trust relative paths. But these were the only
two places using 'chdir', so the present change actually establishes
the property that relative paths can be trusted.

I am not imaginative enough to have a sense of what can go wrong as
we turn those absolute paths into relative paths. I looked at the
blame information, this code comes from the very first ocamldoc
commits by Maxence in 2002. My guess would be that early prototypes
used 'chdir' more agressively (maybe to call the typechecker as an
external command?), making absolute paths useful.
2016-12-26 09:01:15 -05:00
Gabriel Scherer 76489856a6 Merge pull request #982 from Octachron/open_path_for_ocamldoc
Extend #960 to include ocamldoc -open
2016-12-20 22:03:28 -05:00
octachron a867ab083d Extend #960 to include ocamldoc -open 2016-12-21 01:48:57 +01:00
David Allsopp d168db2c78 make alldepend 2016-12-14 13:14:21 +00:00
David Allsopp 6014e97a20 Clean-up -bin-annot artefacts in ocamldoc/
GPR#827 didn't amend clean target.
2016-12-14 13:14:21 +00:00
Etienne Millon 857dd87a7b Fix XSS in ocamldoc
It is possible to craft comments that can expand to unfiltered HTML
fragments.

For example, the following program:

```ocaml
(** {{: "><script>alert(1)</script>"} } *)
let n = 0
```

Would generate a HTML file containing:

```html
<a href=" "><script>alert(1)</script>""> </a>
```

Using this technique it is possible to leak cookies to a third party.

The fix is not perfect since it does not generate usable documentation,
but the generated HTML is harmless.

Note that input like `{{: javascript:alert(1)} }` will still run
arbitrary JS but requires human interaction.
2016-12-07 13:15:06 +01:00
Gabriel Scherer d4d85fa1b9 clarify ocamldoc text parsing error messages
Before, parsing the comment

    (**
    Sample code to iterate over all frames (inlined and non-inlined):
    {|
      (* note: the start-of-code-block above should be after a blank line *)
    |}
    *)

would show

    File ".../foo.mli", line 3, character 6:
        {|
          ^

now it shows

    File ".../foo.mli", line 3, character 6:
    Error parsing text:
        {|
          ^
2016-11-26 11:13:15 -05:00
Sébastien Hinderer b1e93a298b Fix the way the ocamldoc bytecode executable is called under Windows. (#906)
This fixes a problem related to the way ocamldoc's bytecode executable
is called under Windows, reported by @alainfrisch at
https://github.com/ocaml/ocaml/pull/808#issuecomment-257364340

As he explains, ``Even if the PATH is extended with explicit paths to
otherlibs/win32unix and otherlibs/str, ocamlrun will still look up
the stub dlls in the installation directory first, as can be seen by
setting OCAMLRUNPARAM=v=256. If another version was installed in the
same target directory before, the old dlls will be loaded which can lead
to failure (e.g. I just got "Fatal error: unknown C primitive 'unix_lstat'").
A fix could be to set:
CAML_LD_LIBRARY_PATH="../otherlibs/win32unix;../otherlibs/str"
instead of changing PATH''.

This commit implements the proposed fix, due to @alainfrisch.
2016-11-10 22:16:07 +01:00
hendriktews 0bb16e0934 improve installation of additional material (#827)
- install missing mli and cmti files for compiler-libs and otherlibs
- new make target install-compiler-sources to install compiler-libs ml files
2016-10-21 16:40:14 +02:00
Gabriel Scherer 7ad32890fe PR#7037: fix erroneous Location.input_name setting in Pparse.file
When reading a serialized-ast file, Pparse.file sets
Location.input_name to the filename embedded in the AST, and this is
correct. But before this patch it would also set Location.input_name
to the filename if this is a regular file, and this is wrong: this
filename may be a temporary file used for preprocessing (-pp option),
with a randomly-generated name, while Location.input_name is in fact
already correctly set to the user-provided source path.

I needed to fix two lines in ocamldoc/odoc_analyze.ml that
used !Location.input_file but actually required access to the
post-processing file (ocamldoc re-opens source files and rereads them
to detect documentation comments). This is not an invasive change as
the path to the post-processing file is available at this point in the
code (as the [input_file] variable).

This ocamldoc issue was caught thanks to Debian downstream work in bug
triaging ( mlpost breaks if it is not fixed, see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=802347 ) and package
maintenance (this bug would not have been found if Debian maintainers
had not kept the mlpost documentation generator working even after
non-trivial ocamldoc changes).
2016-10-17 12:50:37 -04:00
Mark Shinwell 2da2fcdb66 Annotate Texp_function with an Ident.t for the parameter (#831) 2016-10-14 09:34:50 +01:00
hendriktews 928a7a9659 fix make -j world.opt (#822) 2016-10-05 13:51:47 +02:00
Etienne Millon c09e6b3842 Fix CSS color declaration
There is a typo in the generated CSS for link to modules in the index
page. CSS colors should start with `#`.

As a consequence, this also makes the default stylesheet valid according
to <https://jigsaw.w3.org/css-validator>.
2016-10-04 11:55:51 +02:00
Sébastien Hinderer 28f91dfd1a Merge Unix and Windows build systems in the ocamldoc directory (#808)
This commit changes the behaviour of both the Unix and Windows build systems.
The changes are either specific to one build system or common to both.

Changes specific to the Unix build system:

  - Use the -slash option when invoking ocamldep. This does nothing on
    Unix and makes it possible to use the same command under Unix and Windows.

  - install target:

    - Directories are created unconditionnally, instead of creating them
      only if they do not already exist
      (also true for the installopt target)

    - cp no longer uses the -f flag, to be consistent with the
      other directories

    - The custom directory $(INSTALL_LIBDIR)/custom is no longer created
      because nothing was installed there anyway

  - In the opt.opt target, consecutive calls to make have been
    replaced by prerequisites, enhancing parallelisation opportunities.

Changes specific to the Windows build system:

  - Whaen compiling .ml files, use the same line-number-preserving
    preprocessor as under Unix, rather than the grep -v DEBUG command.

  - ocamldoc generators and odoc_test are now compiled

  - ocamldoc can now be run from sources to generate the documentation
    of the standard library

  - The test targets are now also available under Windows

  - opt.opt now builds native-code versions of the generators

Changes affecting both Unix and Windows build systems:

  - The targets that were depending on the empty "dummy" target
    are now declared as .PHONY targets, dummy has been removed.

  - In the all target, successive calls to make have been replaced
    by prerequisites.

  - Commands executed by make clean are now displayed instead of being
    executed silently.
2016-09-15 00:46:11 +02:00
octachron 788819687f PR#7350: ocamldoc, viewport metadata for html 2016-09-12 22:45:23 +02:00
octachron 142494cd46 PR#7272: ocamldoc, escape blanks outside of <pre>
With this commit, ocamldoc does not escape anymore space characters
within the <pre> </pre> tags and instead escape space and newline
characters inside <code> </code> when a <pre>-like behavior is desired.

Moreover, the type_* files generated by ocamldoc are correctly assigned
a <pre>-like behavior.
2016-09-08 02:21:47 +02:00
Gabriel Scherer 32e0b65c0c Merge pull request #784 from Octachron/ocamldoc_short_description_for_txt
MPR#7333: Ocamldoc, use first sentence as a short description for text files in global overviews
2016-08-31 22:34:09 +02:00
octachron 55282ebf5f Fix: preserve ocamldoc module info logic 2016-08-31 14:16:19 +02:00
Fabrice Le Fessant a424f0aae1 Add missing locations in the parsetree (#749)
They are not propagated to the typedtree yet.
2016-08-29 16:21:38 +02:00
octachron 9cca221a07 PR#7333, ocamldoc: short description for txt files 2016-08-28 22:11:42 +02:00
Leo White caadb9de8a Allow more module aliases in strengthening 2016-07-28 10:13:32 +01:00
octachron dcceb46358 Ocamldoc: improve support for inline records
This commit improves support for inline record and associated
documentation within ocamldoc. Note that the support for documentation
on inline record field could be improved in the various ocamldoc
backends.
2016-07-28 02:21:16 +02:00
octachron 5667afe418 Ocamldoc: factorize location handling in odoc_sig 2016-07-27 01:13:36 +02:00
Gabriel Scherer 38c3db40c7 Merge pull request #718 from Octachron/ocamldoc_extension_cstr_order
Ocamldoc: fix extension constructor order
2016-07-26 19:00:38 -04:00
octachron 45df50c90d ocamldoc: fix extension constructor order
Fix an inversion of constructor orders within odoc_sig that was also
responsible for dropped documentation comments.
2016-07-26 22:56:16 +02:00
Damien Doligez d5a6e50ebe GPR#606: add unboxed types 2016-07-21 13:51:46 +02:00
Alain Frisch 5adb8099e5 Merge pull request #684 from alainfrisch/unused_module_warning
Detect unused module declarations
2016-07-19 09:28:00 +02:00
alainfrisch 32f0e2120c Detect unused module declarations. 2016-07-18 10:35:19 +02:00
octachron 69a65a0034 Ocamldoc: display inline record within exceptions
This commit adds a very basic handling of inline record within
exceptions for signature items. Previously, a signature like

sig
  exception E of {lbl:int}
end

would crash OCamldoc due to an assertion failure.
With this commit, the previous signature should be correctly
displayed by ocamldoc as

sig
  exception E of {lbl:int}
end

Beware, that the same exception as structure item would still
crash ocamldoc at the time of this commit.
2016-07-14 17:14:16 +02:00
Fabrice Le Fessant bfc36003aa Add hooks on some compilation phases 2016-07-12 17:59:58 +02:00
Gabriel Scherer 5f1bc3ef6f Make Pparse functions type-safe
In order to remove some redundancy, the Pparse modules used a dirty
Obj.magic trick to manipulate either structure or signature values
(ASTs parsed from source files). This unsafe approach means that
programming mistakes may result in broken type soudness, and indeed
I myself had to track a very puzzling Segfault during the development
of my Menhir backend (due to a copy-paste error I was passing
Parse.implementation instead of Parse.interface somewhere). Wondering
why your parser generator seems to generate segfaulting parsers is
Not Fun.

This change means that the external interface of Pparse has changed
a bit. There is no way to fulfill the type of Pparse.file in
a type-safe way

    val file : formatter -> tool_name:string -> string ->
      (Lexing.lexbuf -> 'a) -> string -> 'a

as it promises to be able to process any ast type 'a depending on the
magic number (the last string argument). The knew type-safe interface is

    val file : formatter -> tool_name:string -> string ->
      (Lexing.lexbuf -> 'a) -> 'a ast_kind -> 'a

where ['a ast_kind] is a GADT type:

    type 'a ast_kind =
    | Structure : Parsetree.structure ast_kind
    | Signature : Parsetree.signature ast_kind
2016-06-29 21:23:28 -04:00
octachron 34b425ebf6 Ocamldoc: improve "-open" option consistency
* drop test on Clflags.nopervasives:
    the nopervasives flag is not supported by ocamldoc
* open inner modules and not only cmi files
2016-06-17 12:47:44 +02:00
octachron 6d0570242f Ocamldoc: open modules listed in "-open" option 2016-06-15 13:12:19 -04:00
Sébastien Hinderer 50147913ac Call the '#' sign hash rather than sharp. 2016-05-09 16:34:40 +02:00
Alain Frisch 2c7c9b419f Merge pull request #541 from alainfrisch/ocamldep_in_core
Move depend.ml into compilerlibs (ocamlcommon).
2016-04-28 15:02:50 +02:00
Demi Obenour fe05f8fc29 Add `-alias-deps` and `-app-funct`
This was meant for GPR #514, but I forgot to include it.
2016-04-19 12:21:09 -04:00
Demi Obenour 795a4d532d Add explicit command-line flags for currently-default settings
-no-keep-docs
    -no-keep-locs
    -no-principal
    -no-rectypes
    -no-strict-formats
2016-04-18 10:53:51 -04:00
alainfrisch c1ead896a2 Pass -slash to ocamldep so that dependencies generated from a Windows system are closer to those generated from a Unix system. 2016-04-13 17:04:15 +02:00
alainfrisch 8d9dd27cd4 Move depend.ml into compilerlibs (ocamlcommon).
This allows external tools to rely on the features provided by this module.  An example
is ocamldoc itself, which could now be implemented as an external tool.

Note that LexiFi variants of OCaml has been embedding depend.ml in the compiler for a long
time in order to support a stricter dependency mode where the compiler is only allowed to load .cmi
files corresponding to dependencies as inferred by ocamldep (hereby ensuring that ocamldep is
sound by construction).
2016-04-13 16:46:32 +02:00
Alain Frisch b8e418e9f3 More warnings for ocamldoc. 2016-03-15 22:47:33 +01:00
Alain Frisch f2b45c0d0f Probable bug-fix. 2016-03-15 22:47:31 +01:00
Damien Doligez 9166e7003e update .depend and bootstrap compilers before release 2016-02-29 14:07:07 +01:00
Damien Doligez 6d071e8187 fix syntax error in debug code in odoc_sig.ml 2016-02-19 11:09:55 +01:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
Damien Doligez ee8f71101b clean up whitespace and cut long lines 2016-02-17 13:36:27 +01:00
Christophe Troestler 7f6a8ae2f0 Protect install paths against spaces (on Windows) 2016-02-10 14:46:39 +01:00
Pierre Chambart b0b0f6609c Enable flambda 2016-01-28 15:04:47 +01:00
alainfrisch ae3af451b8 Remove useless bindings, use proper sequencing instead of 'let _ = ... in ...'. 2016-01-20 00:02:30 +01:00
David Allsopp b46843fb69 Allow compilation using bootstrapped FlexDLL
Extend the previous patch allowing make -f Makefile.nt flexdll
install-flexdll not to require the install-flexdll stage.

OCAML_FLEXLINK is utilised as required to allow compilation of the entire
system using an in-tree compiled flexlink. The build process simply
required the flexdll target to appear before world.

opt.opt compiles a native code version of flexlink.exe as flexlink.opt.

install always installs flexlink.exe if it was compiled along with any
required .manifest files. It also installs the appropriate .o/.obj files
to $(INSTALL_LIBDIR).

At present, the bootstrapping is not extended to the Cygwin ports.
2016-01-15 17:07:12 +00:00
Armael f60e1d7a5c PR#7108: ocamldoc, have -html preserve custom/extended html generators
Previsously
  ocamldoc -g better_html.cmo -html
would just use the standard HTML generator instead of keeping the
generator extended by better_html.cmo. This patch makes sure that when
a standard option (-html, -latex, -texi, -man, -dot) is requested,
extended generators for the same format are chosen if they are
present.

Note that there is still a global "current generator setting", so in particular
  -g better_html.cmo -man
will throw away the extended generator, and
  -g better_html.cmo -man -html
corresponds to the old behaviour.
2016-01-02 07:01:14 +01:00
octachron 9b161ab1ad Ocamldoc: erase empty constructor comment
When a type definition exposes constructors, adding an empty
constructor comment just after the last constructor is the only way to
place a documentation comment after the type definition and still
attach this comment to the type definition.
However, this empty comment is still printed by most documentation
generators. To fix this aesthetic conundrum, this commit erases empty
constructor comments when constructing the associated
Odoc_type.variant_constructor and thus prevents any printing of these
empty comments.
2015-12-28 18:16:23 +01:00
Gabriel Scherer def8de3676 fix an ocamldoc -j5 build issue caused by GPR #319 (.cmx warnings) 2015-12-26 16:19:33 +01:00
Leo White 06d49a6694 Install ocamldoc .cmx files 2015-12-26 08:29:48 +00:00
Damien Doligez 0225ca01e3 GC latency improvements 2015-12-21 14:27:46 +01:00
octachron 551f2e5373 PR#7075: fix repeated documentation comments
This commit adds a hook in "parsing/lexer.ml{i,l}" to deactivate the generation of
docstring items. This hook is used by ocamldoc to avoid interferences between these
items and the ocamldoc documentation comments parser.
2015-12-17 23:46:03 +01:00
Gabriel Scherer 1645e88824 PR#7096: ocamldoc uses an incorrect subscript/superscript style 2015-12-17 09:10:27 +01:00
Gabriel Scherer 0319173b7d Merge pull request #321 from gasche/reproducible-ocamldoc
Enable ocamldoc to build reproducible manpages [debian patch]
2015-12-12 11:31:50 +01:00
Alain Frisch 22586504ee Fix EOL convention. 2015-12-02 14:51:59 +01:00
alainfrisch 7ad212045f Add module to deal with 'front-end' built-in attributes. 2015-12-02 14:46:14 +01:00
Jacques Garrigue 381328e92e add module alias support to ocamldep 2015-12-01 00:07:36 +09:00
Valentin Lorentz a87c3f20e8 Enable ocamldoc to build reproducible manpages
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=794586
Signed-off-by: Stephane Glondu <steph@glondu.net>
2015-11-29 23:04:56 +01:00
Nicolas Ojeda Bar a524920aa2 Remove Typedtree.optional
From comments in typedtree.mli:

When introduced in 2000, this [type] enabled a more efficient code
generation for optional arguments. However, today the information is
redundant as labels are passed to [transl_apply] too. Could be cleaned
up.
2015-11-25 00:37:46 +01:00
Sergei Lebedev 9dc2b25a0e PR#4518: change location format for reporting errors in ocamldoc 2015-11-24 00:47:31 +03:00