Commit Graph

98 Commits (3755f8f5769cb51504911b0d3b545af90eec61de)

Author SHA1 Message Date
Mark Shinwell 36c163248d Remove support for compiler plugins (#2276)
After consultation on the core developers' list I am proposing this patch to remove support for compiler plugins.

The main motivations for removing compiler plugins are:
- They are a potential security risk.
 - They increase the complexity of the build system and make maintenance of the Dynlink libraries more difficult (although actually, this complexity could probably be reduced after #2268 is merged).
 - Many applications of plugins should be able to be expressed by building custom compiler drivers that link against compilerlibs.

* Remove compiler plugins and hooks
* Add new function Dynlink.unsafe_get_global_symbol but keep it outside the documented API.
* Remove otherlibs/dynlink/nodynlink.ml
* Update Changes
2019-03-13 11:46:37 +01:00
Mark Shinwell c975b15de4 List prefix functions for Misc.Stdlib.List (#2283) 2019-03-06 11:59:03 +01:00
Armaël Guéneau 00411d41f4 ocamltest: explicitly set OCAML_ERROR_STYLE
Explicitly set OCAML_ERROR_STYLE to its default value when running tests,
instead of inheriting the one coming from the outside environment.
2019-02-27 15:13:56 +01:00
Gabriel Scherer dcc8a366aa env refactoring: move EnvLazy to utils/misc.ml 2019-02-16 11:40:28 +01:00
Gabriel Scherer 9847940c01 refactoring: new type aliases Misc.{filepath,modname,crcs,alerts} 2019-01-30 22:37:13 +01:00
Jeremie Dimino 7e0862a212 Refactor load path management and initial environment
- Add a Load_path module which caches files lookup

- Instead of falling back to the external environment, allow to
  declare in the environment that a module comes from the external
  world. This allows persistent structures to shadows non-persistent
  ones
2019-01-30 16:36:38 +00:00
Thomas Refis 742c65d30b List.filter_map (#2185) 2018-12-12 16:29:50 +01:00
Mark Shinwell c237f42521 Fix crc_interfaces stuff 2018-11-13 13:43:38 +00:00
Armaël Guéneau 6b16bcc4fe Add option -error-style and environment variable OCAML_ERROR_STYLE 2018-10-20 17:11:35 +02:00
Armaël Guéneau f954160614 Add source highlighting for errors & warnings in batch mode 2018-10-19 23:38:25 +02:00
Nicolás Ojeda Bär 2bf30a2fb2 Fix regression: return empty list of directories when PATH-like env var is empty 2018-10-10 14:55:04 +02:00
Nicolás Ojeda Bär 223f2e2ffa Add Misc.split_path_contents 2018-10-10 14:54:47 +02:00
Florian Angeletti 558530a8b4 manual: compiler-libs.mld -> compiler_libs.mld 2018-09-12 16:32:37 +02:00
Florian Angeletti ef135a71ae
MPR7546, manual: preambles and warnings for compiler-libs modules (#2020)
* preambles for compiler-libs modules

* Compilerlibs intro and warning link
2018-09-12 09:51:47 +02:00
Jérémie Dimino 9124ab82d1
Deprecate Pervasives (#1605)
- inline Pervasives in Stdlib and re-add Pervasives as a deprecated
module that aliases all elements of Stdlib except the stdlib modules.

- remove special case for Stdlib.Pervasives in printtyp.ml
2018-08-27 12:42:14 +01:00
Drup abc0b7e3ed Add compile_common.ml which contains the basic compilation pipeline.
Factorize the part from compile.ml and optcompile.ml.
2018-07-27 15:07:43 +02:00
Xavier Clerc 7e29162582 Pass the elements from `BUILD_PATH_PREFIX_MAP` to the assembler (#1930) 2018-07-27 12:25:23 +02:00
François Bobot da3f9f34f5 Use reraise_raw_backtrace in Misc.try_finally
And add labels ~always for previous cleanup function and
    ~exceptionally for new cleanup function in exceptional case
2018-07-25 17:58:32 +02:00
Gabriel Radanne 1be47bf7ab Just some tbl things. (#1699) 2018-07-23 13:19:41 +01:00
Xavier Clerc cd06e22582 Shadow the polymorphic comparison in the middle-end (#1811) 2018-07-11 13:50:02 +02:00
Gabriel Scherer 15c89485f3
Merge pull request #1723 from stedolan/remove-meta-static
Remove Meta.static_{alloc, free}.
2018-05-28 16:14:52 +02:00
Gabriel Scherer 559206b4e0 ocamlc -config: new -config-var option to print specific configuration variables
The proposed behavior of `-config-var s` is as follows:
- if `s` is an existing configuration variable, print its value as
  a string and exit with a success return value (0)
- if `s` is not an existing configuration variable, print nothing
  and exit with a failure return value (non-0)

Note that we do not print a newline after the value of the
configuration variable. In particular, if the value is an empty
string, the output is undistinguishable from the output for
non-existing variables, the return value has to be considered instead.

The following alternative behaviors were considered:

- We could print a newline after the configuration value, which
  would let users distinguish empty values from non-existing variables
  by counting the lines of output, and would also be more pleasant for
  users invoking the option from the command-line. However, the way
  bash works on Windows means that $(ocamlc -config-var foo) would keep
  a trailing \r in its output, and portable scripts would have to use
  $(ocamlc -config-var foo | tr -d '\r') instead, which is a pain.
  (This issue was pointed out by David Allsopp)

- We could print a message on the error output if the configuration
  variable does not exist. This is clearer to a human user, but it is
  annoying for scripts if they forget to silence the error output and
  get their output mixed with our error messages. The main use of this
  new feature is for scripting purposes.
2018-04-27 19:54:08 +02:00
Stephen Dolan 7f76b23531 Add LongString.blit_string 2018-04-13 17:11:37 +01:00
Stephen Dolan aa1dc8063a Remove Meta.static_{alloc, free}.
The bytecode runtime now represents code to be loaded as LongString.t,
rather than as a naked pointer to a bytecode block.

(This commit breaks Dynlink of bytecode, due to an issue about digests)
2018-04-13 16:29:33 +01:00
octachron e30e82a219 PR#7363: start documentation headers at {1 2017-10-04 13:05:05 +02:00
Xavier Leroy 071866c447 Create .cmi files atomically (MPR#7472) (#1307)
* MPR#7472: create .cmi files atomically

This is done by writing the data to a temporary file, compute the checksum, finish writing the data, and only then rename the temporary file to the destination .cmi file.

Writing .cmi files this way should avoid the corruption of .cmi files reported in MPR#4991.  This corruption can occur when a .cmi file is produced simultaneously by a run of ocamlc and a run of ocamlopt.

"Atomic" here means "as atomic as the underlying file system guarantees".  The atomicity guarantees of Windows file systems aren't entirely clear.

* Create .annot and .cmt files atomically, like .cmi files

Follow-up to MPR#7472.  The pattern "write to temporary file then rename"
is abstracted in the new function Misc.output_to_file_via_temporary
and applied to .cmi, .cmt and .annot files.
2017-09-06 20:01:15 +02:00
Pierre Chambart 177713ec02 Optimize away some physical equality (#850) 2017-08-01 08:04:03 +01:00
octachron 60ad2d8145 GPR#1187: Minimal documentation for compiler plugins 2017-06-01 18:22:09 +02:00
Max Mouratov d29f3f7104 Fixed erroneous comments 2017-03-28 16:02:05 +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
octachron c4d49c89c1 Add cross-reference detected by ocamldoc 2017-02-01 20:20:02 +01:00
Damien Doligez 0b4fbc2b30 fix whitespace, long lines, headers 2016-08-01 16:06:59 +02:00
alainfrisch d9f43d733e Wrap hook exceptions and have them printed with the standard mechanism instead of stopping the process. 2016-07-12 18:10:08 +02:00
Fabrice Le Fessant bfc36003aa Add hooks on some compilation phases 2016-07-12 17:59:58 +02:00
alainfrisch 19d513466e Misc.Stdlib.String.split -> String.split_on_char. 2016-07-11 15:01:32 +02:00
alainfrisch 15e83644b5 Misc.split -> String.split_on_char. 2016-07-11 14:55:40 +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
Jeremie Dimino 68feb5f286 Add Misc.delete_eol_spaces 2016-03-01 10:36:24 +00:00
Jeremie Dimino b98461c3f3 Add Misc.protect_refs 2016-03-01 10:36:24 +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
David Allsopp 469810f822 Normalise \r\n to \n for deprecated warnings
The formatters used for printing warnings have text mode translation
enabled which means that any Windows endings which creep into warning
texts from deprecated attributes result in \r\r\n in the output.

The effect is largely innocuous, except that it causes the
deprecated_module_use test to fail on Windows.
2016-01-18 16:40:03 +00:00
David Allsopp 9e547e67dd Normalise \r\n to \n for warnings
The formatters used for printing warnings have text mode translation
enabled which means that any Windows endings which creep into warning
texts (e.g. from attributes) result in \r\r\n in the output.

The effect is largely innocuous, except that it causes the
deprecated_module_use test to fail on Windows.
2016-01-18 16:19:08 +00:00
Mark Shinwell 96287792b4 Move color_setting into Misc.Color 2016-01-12 14:35:17 +01:00
Mark Shinwell ca039d77fb Merge pull request #357 from mshinwell/flambda_prereq-misc-list
GPR#357: Add various utility functions in Misc
2016-01-12 14:17:55 +01:00
Damien Doligez 80c674b0c1 make the list functions tail-rec and improve documentation comments 2016-01-12 14:09:03 +01:00
Mark Shinwell be679a7453 Various changes 2015-12-30 14:43:44 +00:00
Mark Shinwell c3e15cd73b Various utility functions in Misc 2015-12-18 15:55:54 +00:00
Mark Shinwell 593738ae72 Add Misc.fatal_errorf 2015-12-18 15:50:24 +00:00
Hugo Heuzard 9eca3e4519 Parse arbitrary precision integers ..
.. and allow any letter in [g-zG-Z] as modifier (previously 'l','L','n')
Also allow modifier for floats
This give more freedom to ppx rewritters (what about a ppx for zarith)

Checks are performed when translating from Parsetree to Typedtree.
Invalid_literal is raised if the modifier is not recognized ([lLn]?)
Integer_overflow is raised as before.

Lexer: use g-zG-Z for integer literal modifier

Lexer: Allow modifier on float

Clean wrt previous commits

Lexer: use named substring

Cleanup

typo

doc

fix after rebase

rebase on  trunk

Update typecore.ml

Fix printast.ml
2015-12-03 17:20:48 +01:00
Jacques Garrigue a335b18a45 merge branches/gadt-warnings
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16532 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-23 08:33:44 +00:00