Commit Graph

24 Commits (f6279a64b5f8812fed05e8bfeaa9bffcf7b6933f)

Author SHA1 Message Date
Gabriel Scherer 9d81d6a10e new Misc.Magic_number module for magic number handling
This module was originally inspired by js_of_ocaml Misc.MagicNumber module
https://github.com/ocsigen/js_of_ocaml/blob/151b811/compiler/util.cppo.ml#L277-L347

It provides parsing and validation function for magic numbers, that
can tell the difference between "not a valid magic number" and "a
valid magic number, but with another version", and print user-friendly
user messages about it.

It does not contain any knowledge for where to find the magic number
in an OCaml file (this depends on the file format); the parsing
function should be called with an input channel already at the right
position for whichever format is expect.
2019-12-03 00:08:29 +01:00
Nicolás Ojeda Bär 3d7fc7530a Remove ocamltests files 2019-09-28 18:03:59 +02:00
Daniel Bünzli a7afd89003 s/string_of_int/Int.to_string/g 2018-11-07 13:52:02 +01:00
Xavier Clerc 7e29162582 Pass the elements from `BUILD_PATH_PREFIX_MAP` to the assembler (#1930) 2018-07-27 12:25:23 +02:00
David Allsopp b5d1929e87 Whitespace and overlong line fixes. 2018-06-14 15:15:34 +01: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
Sébastien Hinderer 54b8513982 Migrate the utils tests to ocamltest 2018-04-03 22:11:45 +02:00
Max Mouratov 7c6b2ed3e7 More robust implementation of Misc.no_overflow_mul (#1520)
* More robust implementation of Misc.no_overflow_mul

The old one fails on [a = min_int, b = -1] and [b = 0].  The new one is taken from Hacker's Delight.

* Changes: add entry

* testsuite: add tests for Misc.no_overflow_{add,sub,mul}
2017-12-20 16:45:39 +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
Mark Shinwell 89cb79b18c fix testsuite 2016-01-12 18:01:45 +01:00
Pierre Chambart ce63c499b1 Fix merge problems 2016-01-12 16:29:22 +01:00
Mark Shinwell c00323309c Merge remote-tracking branch 'chambart/flambda_prereq-scc' into flambda_prereq-scc 2016-01-12 15:15:23 +01:00
Pierre Chambart 09d4bc9025 Fix testsuite for strongly_connect_components 2016-01-12 14:43:17 +01:00
Mark Shinwell bf22a9a524 fixes 2016-01-12 14:14:37 +01:00
Mark Shinwell c7aee2de1d fixes 2015-12-23 11:57:55 +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 078afef9e1 make the edit_distance testsuite bytecode-only (Leo White)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16042 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-04-26 20:00:55 +00:00
Damien Doligez 7844495624 Merge branch 4.01 from branching point to 4.01.0+rc1
Command line used:
  svn merge --accept postpone -r 13776:14055 $REPO/version/4.01 .


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14060 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-04 15:12:37 +00:00
Damien Doligez a2f17916d2 porting to MSVC64; some cleanup; ignore .obj and .lib files
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13654 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-05-07 09:39:38 +00:00
Damien Doligez e4f810e64f last fixes to make the testsuite work under mingw
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13636 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-30 09:25:14 +00:00
Damien Doligez 146084a63e tests/utils: add quotes in Makefile
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13632 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-29 19:16:01 +00:00
Damien Doligez 87392bc090 tests/utils/Makefile: port to mingw
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13622 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-29 16:54:26 +00:00
Damien Doligez 6e7c9f60b1 make it work also on 32-bit machines
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13525 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-13 20:24:06 +00:00
Alain Frisch 9dc80e8a5e #5768: add tests.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13021 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-16 17:11:39 +00:00