Commit Graph

511 Commits (bdd9ca391e3a56253d7480b07bb1a8aac361904c)

Author SHA1 Message Date
octachron b494ac7b06 ocamldep: color cycle error message 2018-02-28 13:35:30 +01: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 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
Xavier Leroy e2e928fafe
MPR#7710: cyclic dependencies are an error for ocamldep -sort (#1578)
Before, cyclic dependencies were reported as a warning, and ocamldep -sort would exit with code 0.
Now, the message says "error" and the exit code is nonzero.
2018-02-11 14:54: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
Gabriel Scherer a202aa032b rename the configure-time safe-string options for clarity
-(un)safe-string becomes -(no-)force-safe-string
-(un)safe-string-default becomes -default-unsafe-string

Config.safe_string (and Clflags.unsafe_string) keep their name for
backward-compatibility, as well as the C define CAML_SAFE_STRING
(which corresponds to -force-safe-string).
2017-10-02 14:42:19 +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 0bf9ceaa3f toplevel: remove plugin option in toplevel 2017-09-30 11:03:53 +02:00
Fabrice Le Fessant f20a0a042e Allow first character of OCAMLPARAM to specify an alternative separator
The alternative separator must be in ":|; ,".
2017-09-29 13:38:59 +02:00
Mark Shinwell b65096678b Register availability analysis (#856) 2017-09-15 11:08:14 +01:00
Daniel Bünzli b5100112b4 Clflags: switch default value of keep_locs from false to true.
This provides better error messages from the toolchain by default.
2017-06-30 13:13:06 +02:00
sliquister 3f76c0525b generalize -dtimings to show allocation, top heap size (#1152) 2017-06-09 12:29:21 +01:00
Gabriel Scherer 2072b5d063 Merge pull request #1187 from Octachron/document_plugins
Manual: minimal documentation for compiler plugins
2017-06-04 10:43:59 -04:00
octachron 1a4dc2fa26 GPR#1187: cite typemod and pparse plugin hooks 2017-06-01 22:43:30 +02:00
Fabrice Le Fessant 8daa184d95 New -depend option for ocamlc/ocamlopt 2017-06-01 15:56:30 +02:00
David Allsopp 65fd726329 Install bootstrapped FlexDLL objects to flexdll/
The install-flexdll target now puts the object files for FlexDLL in a
subdirectory flexdll of the Standard Library instead of in the Standard
Library itself.

A configuration tweak means that -I +flexdll is effectively added to all
compiler invocations and also a pseudo-option -L+flexdll to ocamlmklib
calls to Config.mkdll which fixes PR#7373.
2017-04-09 19:00:06 +02:00
Hannes Mehnert 76bf7c568e Respect OCAML_COLOR environment variable for deciding whether to use colors
Since 4.03, OCaml supports coloring its messages to standard output and standard
error, depending on the "-color" argument ({always,never,auto}).  This commit
adds support for the environment variable "OCAML_COLOR" (which value can as well
be {always,never,auto}).

The command line argument "-color" takes precedence, "OCAML_COLOR" is only
taken into consideration if no "-color" is provided.

The motivation for this is that the user should have control over coloring
OCaml's output messages.  OCamlbuild, a widely used build tool executes OCaml
not under a tty (and OCaml does not colorize errors and warnings), which lead
various packages use `color(always)` in their `_tags` files, which breaks with
other (non-interactive) programs (i.e.  editor helpers).

Further discussion was done at https://github.com/ocaml/ocamlbuild/issues/87 and
https://github.com/ocaml/ocaml/pull/1098.
2017-03-15 08:24:13 +00: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
Valentin Gatien-Baron bf96a7ac42 display the output of -dtimings as a hierarchy 2017-03-07 15:43:57 -05:00
Nicolas Ojeda Bar e75c87dc48 Initial import of linear-scan-register-allocator
The code in this commit was written by Marcell Fischbach & Benedikt Meurer.
See [Mantis#5324](http://caml.inria.fr/mantis/view.php?id=5324) for some
context.

The code (which was originally written against 3.12) was ported to trunk by
doing

```bash
git clone https://github.com/bmeurer/ocaml-experimental/
cd ocaml-experimental
git diff master...linear-scan-register-allocator > t.diff
```

and then applying the diff by hand.
2017-02-22 17:09:18 +01:00
Valentin Gatien-Baron 39555a7f32 in -dtimings, include the time spent in -ppx, and the time spent demarshalling the output of -pp 2017-02-01 16:24:20 -05:00
Valentin Gatien-Baron 81dafd7ee2 making -dtimings include time spent typing mli's 2017-02-01 16:24:20 -05:00
Fabrice Le Fessant 522471d7cb Allow plugins to declare new arguments with Clflags.add_arguments (#796) 2017-01-17 14:34:35 +01:00
Bernhard Schommer 9b2b2b64f8 PR#7460, GPR#1011: Fix uncaught Arg.Bad exception in compenv.ml
This was a regression in 4.04.0, where passing files with unknown
extension (foo.xwds) to the compiler raises an uncaught Arg.Bad
exception.
2017-01-14 22:22:30 +01:00
Damien Doligez 2c521d23bd fix whitespace and overlong lines 2016-12-14 13:14:21 +00:00
Fabrice Le Fessant 2ecd3f43e4 Fix order of arguments with -cclib XXX (#761) 2016-12-14 13:14:21 +00:00
aalekseyev cf19debb3e Make "-open" command line flag accept a module path (#960)
* Make "-open" command line flag accept a module path
2016-12-09 08:27:06 -05:00
Stephen Dolan a35c6117e6 Instrumentation for american fuzzy lop (afl-fuzz) (#504) 2016-12-06 17:18:04 +01:00
Sébastien Hinderer 54e6aecd77 Improve handling of platforms that do not have gprof profiling support (#933)
This commit modifies these two behaviours:

1. ``make install'' installs libraries with profiling support only when
this makes sense.

2. On platforms that do not support profiling with gprof, the -p option of
ocamlopt produces an error message.
On such platforms, ``make install'' was installing dummy profiling
libraries and ocamlopt's -p option was silently ignored.

In addition, this commit modifies the values of the PROFILING make
variable. Before the commit it was either prof or noprof. After the
commit it is either true or false.

In the asmrun directory, the call to ranlib for libasmrunp.a has also been
removed from the install target because this command is already invoked
in the rule that builds libasmrunp.a.

ocamlc/ocamlopt -config now prints the state of profiling support
2016-11-25 17:24:44 +01:00
Gabriel Scherer 0657fd8193 Revert "Improve handling of platforms that do not have gprof profiling support (#933)"
This reverts commit 8adfe15f18.

This is a temporary revert caused by Continuous Integration
failure. We'll investigate the issue and merge again when it is fixed.
2016-11-25 11:12:56 -05:00
Sébastien Hinderer 8adfe15f18 Improve handling of platforms that do not have gprof profiling support (#933)
This commit modifies these two behaviours:

1. ``make install'' installs libraries with profiling support only when
this makes sense.

2. On platforms that do not support profiling with gprof, the -p option of
ocamlopt produces an error message.
On such platforms, ``make install'' was installing dummy profiling
libraries and ocamlopt's -p option was silently ignored.

In addition, this commit modifies the values of the PROFILING make
variable. Before the commit it was either prof or noprof. After the
commit it is either true or false.

In the asmrun directory, the call to ranlib for libasmrunp.a has also been
removed from the install target because this command is already invoked
in the rule that builds libasmrunp.a.

ocamlc/ocamlopt -config now prints the state of profiling support
2016-11-25 15:57:14 +01:00
Bernhard Schommer bc81c313b0 Added expand to toplevel. (#864)
* Added expand to toplevel.

The toplevel now also accepts -args and -args0. In order to avoid
problems with the overide_args hack now script file is allowed in
expand options.

* Fixed differences between .ml and .mli

* Added missing expand in opttopmain.

* Added some test for broken -args for toplevel.

The test checks whether the toplevel fails if the script file is passed
via args option.

* Corrected test case.

* Updated error case.

Instead of printing the error string, Arg.Bad is raised and a wrapper is
added around the parse_and_expand_dynamic_argv.

* Added begin ... end around try ... with.

* Added working example an strip error path.

* Use sed to remove path and fixed typo.

* Added documentation.

* Also fix typo in reference file.

* Added PR to the corresponding change entry.

* Reworked Changes entry.

* Added new tests and updated documentation.

A script file in a responsefile now only prints an error message instead
of the help.

* Removed duplicated entry.

* Simplified expand logic.

We only remember where the current last expanded option is.

* Use first non_expand position instead.

* Updated error message.
2016-11-07 11:48:56 -05:00
Bernhard Schommer 67f4c2b663
Terminated instead of seperated. 2016-11-04 19:44:57 +01:00
Bernhard Schommer 17efc32253
Use separated/separator and null character. 2016-11-04 12:50:17 +01: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
Bernhard Schommer 62335624a9
Added simple parse_expand and support ocamldep
The parse_expand function does the same as parse and parse_dynamic
but allows Expand. However it does not update current to avoid
the problem that the array is modified.

This function is used for the ocamlopt, ocamlc, ocamlcp,
ocamloptp and ocamldep.
2016-10-12 09:30:54 +02:00
Bernhard Schommer bfd7e12dff
Trim CR, remove inw parameter and updated docu.
The read_aux function trims the cr character for the new-line
based method and the write functions are simplified without an
additional sep function.

The argument names are changed to match the default naming format
and the documentation is updated to match the implementation
behavior.

Also two new tests for reading and writing empty command lines as
well as a command lines containing empty arguments are added.
2016-10-11 18:50:01 +02:00
Bernhard Schommer 94715ddc87
Added -arg/-args0 to compiler cmd arguments
The -arg/-args0 switch allow it to pass additional command line
arguments in files newline/NUL separated.
2016-10-10 13:09:21 +02:00
Cedric Cellier b0aa84b647 Fix "unknown option '-no-keep-docs'" (#765)
There was a typo in this option name.
2016-08-18 11:30:10 +01:00
Gabriel Scherer 8d0dcd72b3 Merge pull request #758 from lefessan/2016-08-11-omake
Fix build order of -cclib and direct object files
2016-08-11 22:09:51 +02:00
Damien Doligez 0b4fbc2b30 fix whitespace, long lines, headers 2016-08-01 16:06:59 +02:00
Damien Doligez d5a6e50ebe GPR#606: add unboxed types 2016-07-21 13:51:46 +02:00
alainfrisch c8d90398e6 Support -verbose in ocamlnat. 2016-07-20 16:37:52 +02:00
alainfrisch 012e1ef878 "./configure -safe-string" to force safe-string mode
When configured with -safe-string, the OCaml tools will default to the
safe-string mode and ignore -unsafe-string command-line arguments.  This
is intended to serve two purposes:

 - Facilitate the detection of packages that are not ready
   for -safe-string ready.  (Perhaps with some OPAM switch?)

 - Enable some optimizations that assume that all linked units are
   compiled with -safe-string.

Note: currently, there is no check that units compiled with an OCaml
configured without -safe-string are not linked in.
2016-07-19 14:28:51 +02:00
Fabrice Le Fessant f26c0ff8b6 Add plugins in the compiler 2016-07-18 17:43:05 +02:00
Fabrice Le Fessant bfc36003aa Add hooks on some compilation phases 2016-07-12 17:59:58 +02:00
alainfrisch 15e83644b5 Misc.split -> String.split_on_char. 2016-07-11 14:55:40 +02:00
Alain Frisch 2865a8c088 Merge pull request #591 from mlasson/ocamlparam
A few modifications to OCAMLPARAM
2016-07-10 14:44:37 +02:00
alainfrisch aa4f427591 Add Filename.extension and Filename.remove_extension.
The definition was suggested by Daniel Bunzli. It considers
that ".", "..", ".foo" all have an empty extension.

This commit also fixes chop_extension to align with this definition
and adds remove_extension which behaves as chop_extension but
does not fail when the extension is empty.

There used to be a Misc.chop_extension_if_any in the compiler code base.
The commit also replaces it with the new Filename.remove_extension.
2016-07-10 00:16:48 +02:00
Pierre Chambart 25d24e38c2 Also remove linking hack for bytecode
Adds the required_globals information to bytecode compilation units.

This patch also bootstrap ocamlc. The cmo format is changed by this
commit, there is no way around bootstraping here. Note that ocamldep and
ocamllex does not rely on the cmo format, so they are not present in
this commit.

Changes in tests:

* Update test/transprim/comparison_table.ml.reference:
    The (opaque (global List!)) expression is not present anymore

* Update tests/no-alias-deps/aliases.cmo.reference
    The output of objinfo changed
2016-07-08 16:02:26 +02:00
Pierre Chambart 1624c8e7a0 Also remove the forced dependency dummy code hack for closure
This also share the result type of transl_implementation_flambda
and transl_store_implementation
2016-07-08 16:02:26 +02:00
Pierre Chambart cb388c762a Some cleanup to explicit transl_implementation_flambda return values 2016-07-08 16:02:26 +02:00
Pierre Chambart 7286a4978f Allow to force linking modules without generating dummy code 2016-07-08 16:02:26 +02:00
Marc Lasson 2a0341cd09 Fix: use OCAMLPARAM include dir even with threads 2016-07-04 09:53:31 +02:00
Marc Lasson 0fd2964dff Use OCAMLPARAM's objects in toplevel
Only the non-native one (it does not support OCAMLPARAM at all atm).
2016-07-04 09:53:23 +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
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
Marc Lasson 210d7aeafa Do not use OCAMLPARAM objects with -a and -pack
We add a flag 'with_ocamlparam' to the get_objfiles function.
2016-05-18 14:27:00 +02:00
Sébastien Hinderer 3bbf34319e Add the -no-version option to the toplevel.
This option requests the toplevel not to print its version number
at startup.
2016-05-09 17:22:29 +02:00
Sébastien Hinderer eef6cc5eae Option sharing between byetcode and native toplevels. 2016-05-02 15:44:46 +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
Mark Shinwell ee367399a2 Attend to final Flambda CR comments for 4.03 release 2016-03-30 11:29:34 +02:00
alainfrisch 502e4f9336 More warnings when compiling the compiler. 2016-03-15 22:46:35 +01:00
Mark Shinwell 5dced42768 Merge pull request #480 from mshinwell/flambda_unbox-closures
GPR#480: Flambda fix: try to make Unbox_closures behave more reasonably
2016-02-26 16:18:04 +00: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
Leo White 4253ed1530 Tidy up new command-line parameters 2016-02-11 16:02:02 +00:00
Mark Shinwell 4137939cd7 Make warning 59 less unhelpful (includes work by Runhang Li) 2016-02-11 14:35:18 +00:00
Leo White d79380ff63 Enable opaque option in ocamlc 2016-02-11 11:39:14 +00:00
Mark Shinwell bde2bdd206 Reformatting only (to the standards of tools/check-typo) 2016-02-10 18:28:38 +01:00
Damien Doligez 1c28b231ef Revert "PR#6475: accept -o in ocamlc when compiling C files"
This reverts commit 1d8e590c54.

Conflicts:
	Changes
	bytecomp/bytelink.ml
	driver/optcompile.ml
	ocamlbuild/ocaml_specific.ml
	ocamlbuild/testsuite/internal.ml
	utils/ccomp.ml
2016-02-10 10:34:02 +01:00
Mark Shinwell f95fb8bbb0 Bug fixes etc for Flambda 2016-02-09 18:38:16 +01:00
Mark Shinwell a397511031 Import latest Flambda changes 2016-02-09 09:59:26 +01:00
Mark Shinwell 05f1746cb5 Rename to max_arguments_for_tailcalls; revise numbers assuming no unboxed floats using the OCaml calling conventions 2016-02-08 15:02:40 +01:00
Mark Shinwell b5618e8642 max_arguments_without_passing_on-stack 2016-01-29 15:57:36 +00:00
Pierre Chambart b0b0f6609c Enable flambda 2016-01-28 15:04:47 +01:00
Jeremie Dimino d8704f6ba8 Add module Ast_invariants
This module checks all the AST invariants. This is to ensure that all
invariants are written down in one place and are consistently checked
between the various clients of the AST (typer, pprintast, ...).

The invariants are checked in Pparsee, after applying the ppx
rewriters.
2016-01-27 18:41:12 +00:00
Pierre Chambart ab2e736358 Rename compiler_configuration file
Renamed to ocaml_compiler_internal_params.
2016-01-25 18:50:29 +01:00
Pierre Chambart 2555c4e773 Update main and ocamldep 2016-01-25 18:50:29 +01:00
Pierre Chambart 5b2d1e7d5d Reindent compenv 2016-01-25 18:50:29 +01:00
Pierre Chambart d6ea706a02 Add handling of OCAMLPARAM as a file 2016-01-25 18:45:04 +01:00
alainfrisch 87de6a160d Useless bindings, unit patterns, whitespace. 2016-01-19 23:40:55 +01:00
Mark Shinwell d3a8745b84 Merge remote-tracking branch 'ocaml/trunk' into flambda_prereq-clflags 2016-01-15 13:22:04 +00:00
Mark Shinwell 10e5dcfc37 Support 'opaque' in OCAMLPARAM 2016-01-15 11:38:37 +00:00
Mark Shinwell 7d1d8814c0 code review 2016-01-14 17:13:43 +00:00
Mark Shinwell fb4d06a3aa Clflags stuff and Arg_helper 2016-01-14 11:27:30 +00:00
Thomas Refis cae2a7e53c use Timings.source_provenance in more places 2015-12-31 11:00:39 +00:00
Pierre Chambart fc5acece95 Rename type build_kind and sourcefile arguments to source_provenance 2015-12-18 13:54:47 +00:00
Pierre Chambart 99fa546753 Clean up and time separately parsing and preprocessing 2015-12-18 13:35:44 +00:00
Pierre Chambart 0443e425e4 Record the source file name being built in Compilenv 2015-12-18 13:35:44 +00:00
Pierre Chambart b05b5f71f5 Remove last use of Timining.start/stop in {opt,}compile.ml 2015-12-18 13:35:44 +00:00
Pierre Chambart 828e78d4a4 Avoid using Timings.start/stop 2015-12-18 13:35:44 +00:00
Pierre Chambart 233e1b1791 Record compiler runtime 2015-12-18 13:33:10 +00:00
alainfrisch 7ad212045f Add module to deal with 'front-end' built-in attributes. 2015-12-02 14:46:14 +01:00
alainfrisch 945d0c7d7a Keep deprecation flag on compilation unit, extracted from a floating attribute in the .mli file. 2015-11-27 19:13:56 +01:00
Damien Doligez be79451d83 PR#7008: Fatal error in ocamlc with empty compilation unit name
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16523 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-19 13:01:28 +00:00
Damien Doligez b860d63145 whitespace cleanup, cut long lines, add some missing headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16415 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-11 11:58:31 +00:00
Gabriel Scherer cb3bb152ab add option handling for colors in compiler, OCAMLPARAM and ocamlbuild
(Simon Cruanes and Gabriel Scherer)

Use one of
  -color auto
  -color always
  -color never

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16348 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-08-15 15:57:51 +00:00
Alain Frisch 4e9bf58e90 Typo.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16242 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-24 11:34:51 +00:00
Damien Doligez 860c670848 merge branch 4.02 from 4.02.1 (rev 15540) to a few fixes after 4.02.2 (rev 16205)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16214 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-17 14:31:05 +00:00
Leo White 5c55e4cc08 Attach documentation comments to Parsetree
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16189 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-06-28 13:11:50 +00:00
Gabriel Scherer d19a8bd2f1 PR#6636: add a --version option (Peter Zotov)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16141 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-05-24 14:52:57 +00:00
Alain Frisch 63945879c1 Cleanup + better interaction between -intf and -pack (the .cmi file was not added to the list of objects in that case).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16100 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-05-07 12:44:22 +00:00
Alain Frisch 6610c56462 Cleanup.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16099 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-05-07 12:41:39 +00:00
Alain Frisch 918f584b64 #6845: -no-check-prims to tell ocamlc not to check primitives in runtime.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16031 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-04-22 10:53:47 +00:00
Gabriel Scherer eca0967403 PR#6167: OCAMLPARAM support for disabling PIC generation ('pic=0')
(Gabor Pali)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15793 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-01-24 16:35:26 +00:00
Damien Doligez 0296d022e1 PR#6081: ocaml should add script's directory to search path, not current directory
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15779 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-01-16 22:45:06 +00:00
Gabriel Scherer f256b3733d minor: cut too-long lines
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15735 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-21 12:18:10 +00:00
Gabriel Scherer 1d8e590c54 PR#6475: accept -o in ocamlc when compiling C files
(Vincent Laporte, Peter Zotov)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15734 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-21 12:18:07 +00:00
Gabriel Scherer f15f4f3ed8 PR6695: Make sure the compiler only uses ASCII string functions.
This should cover all places involving filenames in the compiler.
There are a few more paths still using Latin-1 in other ways,
e.g. in ocamldoc.

From: Peter Zotov <whitequark@whitequark.org>

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15727 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-21 11:46:14 +00:00
Damien Doligez 031cffd155 merge branch 4.02 from release 4.02.0 to release 4.02.1
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15558 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-15 13:34:58 +00:00
Alain Frisch eb0beeba69 #6582: make backport of #5904 more backwards compatible.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15414 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-02 07:37:08 +00:00
Alain Frisch 44c2066055 #5904: improve support for ppx in the toplevel by allowing ppx processors to keep information across calls (through the use of persistent cookies). Also change Ast_mapper.register so that the function that creates the mapper from arguments is executed once the context has been restored.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15314 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-09-23 14:54:01 +00:00
Damien Doligez a18bc7950b merge changes of version/4.02 from r15121 to r15155
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15168 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-29 17:14:00 +00:00
Damien Doligez cbfe627f92 merge changes from branch 4.02 from branching (rev 14852) to 4.02.0+rc1 (rev 15121)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15125 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-22 13:45:02 +00:00
Gabriel Scherer d02c8fbc55 new -opaque flag: ocamlopt creates .cmx without cross-module info
(Patch by Pierre Chambart and Gabriel Scherer)
(Ack'ed by Damien Doligez)

This enables a form of incremental compilation for ocamlopt: if
A depends on B, and B is compiled with `ocamlopt -opaque`, then minor
implementation changes in B that do not affect the module interface
will not require recompilation of A.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15105 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-18 13:28:34 +00:00
Alain Frisch 047e09748c Cherry-pick 15062,15063,15064 from 4.02 (#6497).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15068 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-07 09:46:34 +00:00
Jacques Garrigue 77cf8b999e * split Typetexp.lookup_module and Typetexp.find_module
* fix semantics of -open by using Typemod.type_open_


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14795 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-12 12:02:26 +00:00
Mark Shinwell 520fad7d1c Jacques forgot a crucial detail
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14792 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-12 08:40:54 +00:00
Jacques Garrigue ccce272966 commit o_and_opens.diff
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14787 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-11 00:17:05 +00:00
Alain Frisch f0ef09de26 Expose a Typemod.type_interface (currently an alias of Typemod.transl_signature) by symmetry with type_implementation.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14759 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-07 12:46:00 +00:00
Jacques Garrigue fc24112e25 change -trans-mod to -no-alias-deps, and update message
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14738 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-05 02:05:30 +00:00
Jérémie Dimino c31d2ab685 revert commit 14728
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14729 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-03 09:07:14 +00:00
Jérémie Dimino f0b74bd726 -o sets the module name
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14728 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-02 16:44:09 +00:00
Jacques Garrigue 95104b3924 revert commit 14719
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14723 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-02 06:19:55 +00:00
Mark Shinwell 521ac0213a weak dependencies with -trans-mod (github/ocamllabs/weak-depends 45e980a,21856a7,merge)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14719 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-01 12:50:20 +00:00
Damien Doligez 5b8df637d2 merge branch "safe-string"
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14705 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-29 11:56:17 +00:00
Xavier Leroy 558f40e344 New back-end optimization pass: common subexpression elimination (CSE).
(Reuses results of previous computations instead of recomputing them.)
(Cherry-picked from branch backend-optim.)
Tested on amd64/linux and i386/linux.
Other back-ends compile (after assorted updates) but are untested.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14688 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-26 10:40:22 +00:00
Xavier Leroy 29b34438e0 - Constant ropagation for float and int32/int64/nativeint arithmetic.
Constant propagation for floats can be turned off with option
  -no-float-const-prop, for codes that change FP rounding modes at
  run-time.
- Clambda / C-- / Mach: represent float constants as FP numbers of type 
  float rather than literals of type string.
- Tested for AMD64; other archs need testing.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14673 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-25 08:41:13 +00:00
Fabrice Le Fessant 100909c7f7 Add OCAMLPARAM option 'can-discard' to remove warnings about unknown version-specific arguments
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14653 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-22 10:10:25 +00:00
Damien Doligez 7303ac34ca fix some of the whitespace problems in the source
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14582 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-12 10:17:02 +00:00
Damien Doligez e8d15e704c merge branch 4.01 from 4.01.0 (revision 14115) to branch closure (revision 14525)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14532 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-04 17:32:35 +00:00
Jacques Garrigue 3b4d7cf63b Merge module-alias branch (cf. PR#6063)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14394 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-01-10 07:53:33 +00:00
Jacques Garrigue d90b126bd4 Add -trans-mod option for transparent module dependencies.
Without that option, dependencies are strict, both for
typing and linking.


git-svn-id: http://caml.inria.fr/svn/ocaml/branches/module-alias@14382 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-12-20 06:55:26 +00:00
Xavier Leroy 33f242aaea Reverting the elimination of the ocamlcomp*.sh scripts, namely the following commits:
14278
14277
14276
14176
14175
14173
14172
14171
14169
14168
14167
These changes need to mature on their own branch.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14329 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-29 13:04:38 +00:00
Wojciech Meyer 241585bc83 build: replace ocamlcomp*.sh.
This script was built from ocamlcomp.sh.in through sed and is called
instead of "ocamlc" (for instance).
It makes it possible to switch from "ocamlc" to "ocamlc.opt" without
changing anything in the Makefiles, only calling sed.

I couldn't cleanly make it handle both a compiler for the target and for
the build. Instead I'm replacing it and doing as much as possible
directly in the Makefiles.
I hoped it would reduce the number of shell invocations, which would
speed things up quite a lot on Windows but I still had to have at least
one since it's not possible to update a make variable from inside a make
rule: i.e. it's not possible to do X=a, build a.opt and update X to be
a.opt.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14168 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-20 00:22:38 +00:00
Alain Frisch 40117f7480 #5817: new compiler flag (-keep-locs) to keep location in cmi files.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14157 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-17 12:45:05 +00:00
Alain Frisch b92a3ca792 Continue.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14122 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 15:50:47 +00:00
Alain Frisch 884ca00fdf Continue cleanup. driver/errors.ml is no longer needed.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14120 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 14:45:03 +00:00
Alain Frisch 8660e346df Continue.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14119 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 14:34:13 +00:00
Alain Frisch bc9e5b0a51 Switch {Translmod,Translcore,Translclass}.Error.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14118 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 14:24:27 +00:00
Alain Frisch 2e16ccd61f Switch Includemod.Error, without trying to split the message (to keep current behavior).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14117 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 14:21:04 +00:00
Alain Frisch af5e566d62 Switch Typetexp.Error, Typedecl.Error, Typemod.Error, Typeclass.Error.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14114 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 14:06:48 +00:00
Alain Frisch 08ed781ecc Switch Ctype.Tags.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14113 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 13:59:45 +00:00
Alain Frisch c18155a018 Switch Cmi_format.Error.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14112 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 13:50:36 +00:00
Alain Frisch de72ef4a89 Simplify common case of unit-wide errors.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14111 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 13:47:04 +00:00
Alain Frisch 6950d6f780 Do not keep file name in exception, after all.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14110 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 13:41:01 +00:00
Alain Frisch 290fe0c0b2 Keep input file in Env.Error. Switch it to the new system.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14109 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 13:00:22 +00:00
Alain Frisch d18a044380 Keep input file in Pparse.Error. Switch it to the new system.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14108 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 12:27:33 +00:00