Commit Graph

104 Commits (d68e0e207765350eb42fed37444d643669f98cee)

Author SHA1 Message Date
Armaël Guéneau d213f9a808 Use a dummy value for line numbers in dummy locations 2018-09-13 09:33:37 +01:00
Armael a3fb865714 Improve the formatting of sub-errors in error/warning reports (#2035)
* Improve the formatting of sub-errors in error/warning reports

This avoids indenting sub-errors on the right of "Error:" (or "Warning x:"), and
implements more compact printing (the sub-location message is printed on the same
line of the location if it can fit).

* Extend the formatting test demonstrating report printing
2018-09-10 10:04:38 +02:00
Armael 49b104f489 Remove support for TERM=norepeat when displaying errors (#1979)
This was used to build the manual, but is not needed anymore since GPR#1863
2018-08-14 15:02:21 +02:00
Armaël Guéneau 79c8a94220 Change (improve) error highlighting in a dumb toplevel 2018-08-08 19:05:23 +02:00
Armaël Guéneau c0820e30cb Location: significantly rework the code printing errors and warnings 2018-08-08 17:42:08 +02:00
Armaël Guéneau 818dc938f0 Reorganize location.ml and add a few comments 2018-08-08 17:42:08 +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
Armaël Guéneau 0ccb589798 Refactor [Location.print_loc]; use it in [highlight_dumb] and expect_test.ml 2018-07-25 11:52:23 +02:00
Armaël Guéneau eae3925b3d Location: generalize [highlight_dumb] to handle several locations 2018-07-12 11:24:23 +02:00
Armaël Guéneau 3ad43ac107 location.ml: do some simple cleanup 2018-07-10 17:46:14 +02:00
Armael 7c9c210884 Move Location.absname to Clflags.absname (#1886) 2018-07-06 13:43:28 +01:00
Armaël Guéneau 806ef95057 Do some trivial cleanup in parsing/location.ml 2018-07-06 09:04:07 +01:00
Thomas Refis 86ed685d26 parser: better locations for type constraints 2018-06-21 11:13:58 +01:00
David Allsopp b5d1929e87 Whitespace and overlong line fixes. 2018-06-14 15:15:34 +01:00
Gabriel Scherer 6c558779da honor the BUILD_PATH_PREFIX_MAP variable if it exists:
<https://reproducible-builds.org/specs/build-path-prefix-map/>
2018-03-01 17:54:16 +01:00
Gabriel Scherer 51b44285d9 Location.show_code_at_location: highlight the code at a given location
This uses the "highligh_dumb" machinery, but is explicitly designed to
not print the location itself. This is for use in the expect-style
tests; the expect-test modification will come in a separate commit,
but it looks as nice as the following:

[%%expect{|
Line _, characters 1-4:
 #bar) -> ();;
  ^^^
Error: Unbound class bar
|}];;
2017-12-12 15:35:02 +01:00
Xavier Leroy 852b595ff3
Remove dependencies on curses/terminfo/termcap C library (#1431)
The terminfo C library was used for displaying error messages from the
toplevel.  Instead, just use ANSI escape sequences to display, and a
ioctl() to get the number of lines of the terminal.

- Remove byterun/terminfo.c
- Add primitive to query number of lines to io.c
  with OS-dependent code in unix.c (ioctl-based implementation)
  and win32.c (no implementation yet)
- Add a Terminfo.num_lines function and simplify interface to Terminfo.setup
- Query num_lines every time an error message needs to be highlighted,
  so as to react to windows resizing.
- Bootstrap to enable removal of old primitives.
2017-11-26 15:49:31 +01:00
Florian Angeletti ea4e009533 GPR#1281: avoid "@." in location print functions (#1281) 2017-08-10 12:03:22 +01:00
alainfrisch f6d53cc38f Deprecation warning when checking signature inclusion
Deprecation warning (3) is currently only reported when directly
accessing a component marked with the deprecated attribute; but it is
missed when we coerce the signature contaning the deprecated component
to a signature without the attribute.

This commit adds the required machinery to detect such cases
and report the same warning. (An alternative design could be
to introduce a new warning for that purpose.)

Some of the new machinery could be used for other purposes:

  - During the inclusion check, keep the location that would used in
    the error message if the check fails.

  - Warnings can now hold extra "sub-locations" (and associated
    messages).
2017-04-05 19:13:59 +02:00
sliquister 356d8a9c0c Changing the display of fatal warnings (#948) 2017-03-08 09:16:01 +00: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
Simon Cruanes 9e21876a28 PR#7147: add colors to errors generated by ppx rewriters
The default error printer now adds the maybe colored "Error" prefixed
itself.

None of the convenience functions (`Location.errorf`,
`Location.error_of_printer`, ...) insert the "Error" prefix
anymore. To handle the formatting correctly, a phantom prefix is added
using `Format.pp_print_as`.

Updated the testsuite.
2016-07-11 16:37:32 +01:00
Damien Doligez 033ffae6b1 PR#6906: wrong error location for unmatched paren with #use in toplevel 2016-04-18 11:51:14 +02:00
alainfrisch 502e4f9336 More warnings when compiling the compiler. 2016-03-15 22:46:35 +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 22c15cc2c1 Debuginfo.to_location and Location.print_compact 2016-01-13 16:20:23 +00:00
Damien Doligez 355c982328 PR#6574: get better backtraces in case of compiler crash 2016-01-12 16:51:35 +01: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 c508c47101 colorize error and warning messages, refactor Location
(Simon Cruanes)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16349 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-08-15 15:57:53 +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
Gabriel Scherer f9ea209cb7 GPR#171: allow custom warning printers / catchers
(Benjamin Canou, review by Damien Doligez)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16049 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-04-26 21:05:26 +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 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
Alain Frisch bfccd68ecc Protocol to allow ppx processors to report warnings to the compiler (reported as warning 22).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14762 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-07 14:52:19 +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
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
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 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 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 6ad98b3d09 Port Syntaxerr.Error to the new system. Trickier, because of special way to report some errors in the toplevel (is it really worth the trouble?).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14105 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-11 18:10:59 +00:00
Alain Frisch 47be69c2b0 Cherry-picking commit 14093 from trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14104 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-11 16:08:00 +00:00
Fabrice Le Fessant b171e15a12 Fix fix to PR#3679 : discard CR instead of printing a dot
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13771 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-12 15:32:27 +00:00
Fabrice Le Fessant 5d82e6f17f Fix PR#3679
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13767 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-12 11:53:38 +00:00
Damien Doligez def31744f9 remove all $Id keywords
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13013 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-15 17:50:56 +00:00
Fabrice Le Fessant d39d43e55f merge with branch bin-annot
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12516 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-05-30 14:52:37 +00:00
Alain Frisch a0a14c08fa Enable and fix more warnings.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12498 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-05-29 11:47:28 +00:00
Damien Doligez 38162c1196 remove redundant colon in norepeat mode for the toplevel
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12363 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-04-17 08:02:02 +00:00
Damien Doligez 6c24f4f90b merge version 3.12 from 3.12.1 to r12205
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12210 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-03-08 19:52:03 +00:00
Alain Frisch 1be1d4e834 #5527: use absolute filenames in the message for Warning 31, when requested (-absname).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12198 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-03-07 17:27:59 +00:00