Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] assert + -pp = wrong line number and filename in assert message
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-08-23 (16:28)
From: Paul Stodghill <stodghil@c...>
Subject: [Caml-list] assert + -pp = wrong line number and filename in assert message
The "assert" construct generates an exception which contains the file
name and line number where the "assert" appears.

However, when a preprocessor is used (with the -pp option), the file name
and line number that are recorded are relative to the preprocessor
output file and not to original source file, even when the 
'# linenum "filename"' directives are inserted in the preprocessor

A quick scanner of ocaml-3.02/parsing/lexer.mll seems to indicate that
the line directive is completely ignored.

milhouse$ uname -a
CYGWIN_NT-5.0 MILHOUSE 1.3.2(0.39/3/2) 2001-05-20 23:28 i686 unknown
milhouse$ ocamlc -v
The Objective Caml compiler, version 3.02
Standard library directory: /usr/local/lib/ocaml
milhouse$ cat 
#! /bin/sh

echo '# 1 "'$1'"'
cat $1
milhouse$ cat
assert false;;
milhouse$ ocamlc -o assert_bug.exe -pp './' 
milhouse$ ./assert_bug.exe 
Fatal error: uncaught exception Assert_failure("/home/stodghil/tmp/camlpp0", 20, 32)

Bug reports:  FAQ:
To unsubscribe, mail  Archives: