Commit Graph

13257 Commits (ada91e082ac17bef6f17b7a6bb5100689926473e)

Author SHA1 Message Date
alainfrisch ada91e082a Use full name for contributor. 2016-06-22 20:34:37 +02:00
Jacques Garrigue 3c14f2ed35 Fix PR#6505 extra report (but not -principal) 2016-06-22 10:50:59 +09:00
Gabriel Scherer 06526bbc26 Unix.sleep 0.: Changes entry 2016-06-21 10:38:20 -04:00
Hannes Mehnert f6044bdca3 fix regression: Unix.sleep 0 does again a syscall, as before 4.03 2016-06-21 10:33:31 -04:00
Hannes Mehnert d688f23f03 discover nanosleep() availability in configure 2016-06-21 10:33:31 -04:00
Damien Doligez 4063cb317a Merge pull request #548 from Octachron/empty_docstring
Empty documentation comment (**)
2016-06-21 14:04:20 +02:00
alainfrisch a8c0370928 Separate items in Changes with an empty line. 2016-06-21 12:56:10 +02:00
alainfrisch f6428177e0 Fix #7276: use slow-path emulation of select under Windows with more than FD_SETSIZE sockets. 2016-06-21 12:39:38 +02:00
alainfrisch 1082ef6e3d Add missing @since attributes. 2016-06-20 19:01:36 +02:00
Damien Doligez 6901555bd1 Merge pull request #619 from alainfrisch/contributing_stdlib
Some words about contributing to the stdlib
2016-06-20 16:03:47 +02:00
Mark Shinwell c992adb232 Add X86_dsl.r13 2016-06-20 11:19:17 +01:00
Mark Shinwell 3e02056ae7 Expose caml_sys_time_unboxed (in private header) 2016-06-20 10:28:20 +01:00
Gabriel Scherer bc5cbd6cba minor typos in comments 2016-06-18 21:09:04 -04:00
Mark Shinwell 266c1477b8 Fix Selectgen.join_array (#600) 2016-06-16 16:54:17 +02:00
alainfrisch 18bc91a8e2 Some words about contributing to the stdlib. 2016-06-16 16:21:12 +02:00
octachron 6d0570242f Ocamldoc: open modules listed in "-open" option 2016-06-15 13:12:19 -04:00
Gabriel Scherer 8e2cf4465c Merge pull request #588 from lijunsong/solaris-build
MPR#7256 build ocaml on Sparc Solaris
2016-06-15 13:05:39 -04:00
Gabriel Scherer 75f0fd05de Merge pull request #605 from dra27/fix-windows-distrib
Fix selecting wrong README files in Makefile.nt
2016-06-15 13:03:26 -04:00
Gabriel Scherer 5e3fdf7f83 Merge pull request #614 from Fourchaux/trunk
typos ('middle_end' directory)
2016-06-15 12:59:55 -04:00
Damien Doligez 387e0e283e Merge pull request #592 from ghennequin/trunk
Added a function [Genarray.change_layout].
2016-06-15 16:39:44 +02:00
Damien Doligez 2403ac5d38 Merge pull request #597 from johnwhitington/trunk
Fixes for README.adoc
2016-06-15 16:35:18 +02:00
Leo White 712e395cfc Merge pull request #599 from yallop/fix-local-open-pattern-grammar
Fix the reduce/reduce conflicts in the grammar
2016-06-15 15:26:03 +01:00
Damien Doligez 254ff1af00 Merge pull request #618 from shindere/fix-gitignore
.gitignore adjustments.
2016-06-15 14:21:11 +02:00
Sébastien Hinderer 63436acb38 .gitignore fix: /tools/cvt_emit.opt was mentionned twice. 2016-06-15 11:42:37 +02:00
Sébastien Hinderer 6bb28b617b Tell git to ignore tools/{dumpobj.opt,ocamlmktop.opt,ocamlmklib.opt}. 2016-06-15 11:41:32 +02:00
Gabriel Scherer 0323df74a7 PR#6475, GPR#464: update Changes 2016-06-14 11:38:39 -04:00
whitequark be1f3cfa78 Update manpages and manual to account for changes in 221c55a4. 2016-06-14 11:36:35 -04:00
whitequark da56cf6dfd Rigorously handle -o and -c options in presence of multiple arguments.
This addresses PR#6475.

In 4.02 the behavior of ocamlc/ocamlopt with regards to these options
was as follows:
  * options and arguments are parsed left-to-right in the exact order
    in which they are passed, with compilation taking into account
    only the options leftwards from it;
  * "foo.c" is compiled to "foo.o" in current directory;
  * when "-c" is not specified:
    * "foo.ml" is compiled to "foo.cmo"/"foo.cmxo"
      in current directory;
    * after all files have been compiled, if any .ml files are passed,
      all provided files are linked as:
      * when "-o" is not specified: "a.out" in current directory;
      * when "-o out" is specified: "out".
  * when "-c" is specified:
    * "foo.ml" is compiled to:
      * when "-o" is not specified: "foo.cmo"/"foo.cmxo"
        in current directory;
      * when "-o out" is specified: "out.cmo"/"out.cmxo";
        and then compilation proceeds as if the last "-o" option
        has disappeared.
    * no final link is performed.

The behavior where the build product of the C sources always ended up
in the current directory was problematic: it required buildsystem
hacks to move the file in its proper place and ultimately was racy,
as multiple files with the same basename in different directories
may well end up overwriting each other with e.g. ocamlbuild.

On top of that, the behavior was quite confusing, since it is not
only stateful and dependent on argument order, but also the mere act
of compilation changed state.

The commit 1d8e590c has attempted to rectify that by looking at
the "-o" option when compiling C files, too. After that commit,
the behavior of ocamlc/ocamlopt was as follows (only the handling
of C files was changed, but the entire chart is provided for
posterity):
  * options and arguments are parsed left-to-right in the exact order
    in which they are passed, with compilation taking into account
    only the options leftwards from it;
  * "foo.c" is compiled to:
    * when "-o" is not specified: "foo.o" in current directory;
    * when "-o out" is specified: "out".
  * when "-c" is not specified:
    * "foo.ml" is compiled to "foo.cmo"/"foo.cmxo"
      in current directory;
    * after all files have been compiled, if any .ml files are passed,
      all provided files are linked as:
      * when "-o" is not specified: "a.out" in current directory;
      * when "-o out" is specified: "out".
  * when "-c" is specified:
    * "foo.ml" is compiled to:
      * when "-o" is not specified: "foo.cmo"/"foo.cmxo"
        in current directory;
      * when "-o out" is specified: "out.cmo"/"out.cmxo";
        and then compilation proceeds as if the last "-o" option
        has disappeared.
    * no final link is performed.

There is a non-obvious bug here. Specifically, what happens if more
than one C source file is passed together with a "-o" option? Also,
what happens if a C source file is passed together with a "-o" option
and then a final link is performed? The answer is that
the intermediate build product gets silently overwritten, with quite
opaque errors as a result.

There is some code (and even buildsystems) in the wild that is relying
on the fact that the -o option does not affect compilation of C source
files, e.g. by running commands such as (from ocamlnet):
  ocamlc -custom -o t tend.c t.ml

It might seem that the solution would be to make the behavior of
the compiler drivers for C files match that for the OCaml files;
specifically, pretend that the "-o" option has disappeared once
the C compiler has written a build product to the specified place.

However, this would still break the existing code, and moreover
does not address the underlying problem: that the option parsing
of the OCaml compiler driver is confusing and prone to creating
latent bugs.

Instead, this commit finishes (after 1d8e590c and 55d2d420) overhauls
the way option parsing in ocamlc/ocamlopt works to behave as follows:
  * options are parsed left-to-right in the order they are specified;
  * after all options are parsed, arguments are parsed left-to-right
    in the order they were specified;
  * when "-o out" and "-c" are specified:
    * when more than one file is passed, an error message
      is displayed.
    * when one file is passed:
      * "foo.c" is compiled to "out";
      * "foo.ml" is compiled to "out.cmo"/"out.cmxo".
  * when "-o out" is not specified or "-c" is not specified:
    * "foo.c" is compiled to "foo.o" in current directory;
    * "foo.ml" is compiled to "foo.cmo"/"foo.cmxo"
      in current directory;
  * when "-c" is not specified:
    * after all files have been compiled, if any .ml files are passed,
      all provided files are linked as:
      * when "-o" is not specified: "a.out" in current directory;
      * when "-o out" is specified: "out".

In short, the combination of "-o", "-c" and a single source file
compiles that one file to the corresponding intermediate
build product. Otherwise, passing "-o" will either set the name of
the final build product only or error out.

This preserves compatibility with old code, makes the handling of
C and OCaml sources consistent, and overall makes the behavior
of the option parser more straightforward. However, this may break
code that relies on the fact that options are parsed in-order, e.g.
  ocamlc -o t a.ml -g b.ml
where debug info would be built only for "b.ml".

Some alternative implementation paths I have considered:
  * Collect the C sources and process them after OCaml sources,
    while paying attention to any "-o" or "-c" that may have
    been set. This doesn't work because compilation of C sources
    is also affected by many flags, e.g. "-I", and so this would
    have the same drawbacks but none of the benefits;
  * Compile C and OCaml sources in-order as usual, but error out
    when an improper combination of flags is encountered in
    the middle of a compilation. This is technically feasible,
    and is the option that maximally preserves compatibility, but
    it is very complex: it doubles the amount of implicitly mutated
    global state, and there's no guarantee I will get all edge
    cases right. Moreover, the option parsing remains confusing,
    and I strongly believe that the current behavior should not
    remain in place.

On top of that it is hard to imagine cases where setting new options
in the middle of compilation would actually be desirable, because
this mechanism is very inexpressive: it can only add new options and
option values, since there is no way to negate or clear most of
the driver's state. Most likely is that any code that does so,
does it in error and remains operational by pure chance.
2016-06-14 11:36:35 -04:00
whitequark 4dc3efe3b0 Interpret all command-line options before compiling any files.
The behavior of ocamlc and ocamlopt drivers before this commit is
that the command-line options and arguments are processed exactly
sequentially; encountered options (e.g. "-o") modify the state of
the driver, and encountered arguments (e.g. "t.ml") compile
the corresponding file with whatever state the driver had at the time.

This can be quite confusing, because compiler drivers (e.g. gcc/g++,
clang/clang++, rustc, javac, go, ...) either parse the entire command
line before going on to compile files or reject options after
the first argument (only in the case of go). Thus the behavior
of ocamlc and ocamlopt is unexpected.

The following commit provides another reason for this change.
2016-06-14 11:36:35 -04:00
Alain Frisch cba6c6b208 Merge pull request #601 from nojebar/better-locs-for-default-args
Better ghost locs for default parameters.
2016-06-14 14:05:13 +02:00
Damien Doligez 4c096b24a1 Merge pull request #611 from shindere/fix-use-runtime
Fix the -use-runtime option.
2016-06-14 14:01:34 +02:00
Jacques Garrigue 87098044bb switch typing-misc and typing-modules to Makefile.expect 2016-06-13 14:09:23 +09:00
Jacques Garrigue 80d24ec8b0 fix typo in manual 2016-06-13 13:20:05 +09:00
Jacques Garrigue 0c699c5df6 switch tests/type-gadts to Makefile.expect 2016-06-13 11:26:02 +09:00
Jacques Garrigue 4feaea361e Merge pull request #579 from garrigue/nested_equations
MPR#7233: Support GADT equations for non-local abstract types
2016-06-13 10:15:35 +09:00
Jacques Garrigue 29a92d3ca4 add a paragraph in the manual to explain equations on non-local types 2016-06-13 10:09:25 +09:00
Jacques Garrigue 3cb6d6c702 PR#7233: GADT equations for non-local abstract types 2016-06-13 09:25:31 +09:00
Gabriel Scherer 48f1d62f55 minor .mailmap change 2016-06-12 08:05:23 -04:00
Fourchaux cad3b523a6 typos ('middle_end' directory) 2016-06-11 18:05:05 +02:00
octachron 61e8b63e16 GPR#548 changes 2016-06-09 20:17:42 +02:00
octachron 5946fb65b2 Manual: empty documentation comment 2016-06-09 20:14:05 +02:00
octachron 314107a656 Fix stars handling in lexer 2016-06-09 19:59:50 +02:00
octachron eb5ab7aa2b Empty documentation comment (**)
This commit adds (**) as a special empty documentation comment that
can influence the attachment of other documentation comments but is
never emitted as an attribute in the parsetree. An important use of
this empty comment would be to attach a documentation comment to the
type t and not its last constructor Label, without spurious empty
attribute, in the following construction:

type t = Label (**)
(**doc for t*)
2016-06-09 19:59:50 +02:00
Sébastien Hinderer 766ca57138 Fix the -use-runtime option.
This option was broken, as can be seen by using it to compile the
following helloworld.ml program:

let _ = Printf.printf "Hello, world!\n%!"

Then from OCaml's toplevel source directory, compile as follows:

./ocamlc.opt -use-runtime ${HOME}/src/ocaml/byterun/ocamlrun \
  -nostdlib -I stdlib -o helloworld.byte helloworld.ml

And do:

head -1 helloworld.byte

See the double #! at the beginning of the line.

The first one comes from the "header" file which is included and is
correct (it would be a different header on Windows).

The second one is hard-coded and should be removed, this is what
this patch does.
2016-06-08 22:40:37 +02:00
John Whitington 351f1a929d Grammar 2016-06-07 14:07:19 +01:00
Damien Doligez a748528b27 GPR#604: minor doc typo 2016-06-07 14:40:07 +02:00
Damien Doligez 4e6a825aaf consistency of configure option parsing 2016-06-07 14:40:07 +02:00
Damien Doligez 35a75c63ca Merge pull request #587 from drbo/native-by-default2
Install native versions of tools by default.
2016-06-07 14:34:42 +02:00
Demi Obenour d89af40f64 Install native versions of tools by default.
Previously, `ocamlc`, `ocamlopt`, `ocamllex`, and `ocamldep` defaulted
to the bytecode versions of the tools.  However, there is normally no
advantage to the bytecode versions if the native-code versions are
available, except in unusual circumstances.  Instead, install the
native-code versions without the `.opt` suffix.  They are still
installed with the `.opt` suffix for backwards compatibility.  Finally,
install the bytecode versions with the `.byte` suffix, and build
native-code versions of tools that are not currently built in native
code.

Also, remove some duplication in tools/Makefile.shared.

Supersedes GPR #512.
2016-06-06 14:44:10 -04:00
David Allsopp fc424b6a3b Fix selecting wrong README files in Makefile.nt 2016-06-03 09:55:58 +01:00