Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

camlp4 not track valid position in source file #8349

Closed
vicuna opened this issue Oct 30, 2003 · 3 comments
Closed

camlp4 not track valid position in source file #8349

vicuna opened this issue Oct 30, 2003 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 30, 2003

Original bug ID: 1906
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Artem Prysyanuk
Version: 3.07+2
OS: RedHat 9
Submission from: 213.156.75.17.priocom.com (213.156.75.17)

$ ocamlc -version
3.07+2
$ camlp4o -v
Camlp4 version 3.07+2
$ cat a.ml
let test () =
raise Not_found;;
test ();;
$ export OCAMLRUNPARAM=b

Without camlp4 all ok.

$ ocamlc -g a.ml
$ ./a.out
Fatal error: exception Not_found
Raised at file "a.ml", line 2, character 16
Called from file "a.ml", line 3, character 7

But if I use camlp4o, output after exception:

$ ocamlc -pp camlp4o -g a.ml
$ ./a.out
Fatal error: exception Not_found
Raised at file "", line 1, character 31
Called from file "", line 1, character 41

So, file names and line numbers are missing.

@vicuna
Copy link
Author

vicuna commented Nov 6, 2003

Comment author: administrator

Full_Name: Artem Prysyanuk

$ ocamlc -pp camlp4o -g a.ml
$ ./a.out
Fatal error: exception Not_found
Raised at file "", line 1, character 31
Called from file "", line 1, character 41

So, file names and line numbers are missing.

Hello,

This is a known problem that will take some time (and a lot of work)
to fix. Note however that the locations reported are still correct:
if you start from the beginning of line 1 in your file, and go forward
31 characters, you end up at the right position.

Thanks for your report,

-- Damien

@vicuna
Copy link
Author

vicuna commented Nov 6, 2003

Comment author: administrator

On Thu, 6 Nov 2003 16:44:26 +0100 (MET), Damien Doligez
caml-bugs@pauillac.inria.fr wrote:

Full_Name: Artem Prysyanuk

$ ocamlc -pp camlp4o -g a.ml
$ ./a.out
Fatal error: exception Not_found
Raised at file "", line 1, character 31
Called from file "", line 1, character 41

So, file names and line numbers are missing.

Hello,

This is a known problem that will take some time (and a lot of work)
to fix. Note however that the locations reported are still correct:
if you start from the beginning of line 1 in your file, and go forward
31 characters, you end up at the right position.

Yes, I know. But, it's simple example, if I have 10 source files, find
right
position like nightmare.

I make small patch, which solve problem with file name.

PS: I found what emacs mode for ocaml not show types info for files which
was preprocessed camlp4 with this path.

--
Artem Prysyznuk
tema@sit.kiev.ua

diff -ru ocaml-3.07/camlp4/camlp4/argl.ml ocaml-3.07.tema/camlp4/camlp4/argl.ml
--- ocaml-3.07/camlp4/camlp4/argl.ml 2003-07-10 15:28:14.000000000 +0300
+++ ocaml-3.07.tema/camlp4/camlp4/argl.ml 2003-11-06 17:43:28.000000000 +0200
@@ -397,11 +397,12 @@
exit 2
} ];
try

  •  if Pcaml.input_file.val <> "" then
    
  •  if Pcaml.input_file.val <> "" then do {
    
  •    Ast2pt.glob_fname.val := Pcaml.input_file.val;
       match file_kind.val with
       [ Intf -> process_intf ()
       | Impl -> process_impl () ]
    
  •  else ()
    
  •  } else ()
    
    with exc ->
    do {
    Format.set_formatter_out_channel stderr;
    diff -ru ocaml-3.07/camlp4/camlp4/ast2pt.mli ocaml-3.07.tema/camlp4/camlp4/ast2pt.mli
    --- ocaml-3.07/camlp4/camlp4/ast2pt.mli 2002-07-19 17:53:44.000000000 +0300
    +++ ocaml-3.07.tema/camlp4/camlp4/ast2pt.mli 2003-11-06 17:43:28.000000000 +0200
    @@ -12,6 +12,7 @@

(* $Id: ast2pt.mli,v 1.3 2002/07/19 14:53:44 mauny Exp $ *)

+value glob_fname : ref string;
value fast : ref bool;
value no_constructors_arity : ref bool;
value mkloc : (int * int) -> Location.t;



@vicuna
Copy link
Author

vicuna commented May 12, 2004

Comment author: administrator

see also #8436
MM working on a revamp of locations in camlp4 2004-01-07
Fixed by MM on 2004-05-12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant