caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Paul Stodghill <stodghil@cs.cornell.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] assert + -pp = wrong line number and filename in assert message
Date: Tue, 28 Aug 2001 09:31:00 +0200	[thread overview]
Message-ID: <20010828093100.B1759@pauillac.inria.fr> (raw)
In-Reply-To: <yz1k7zu91wf.fsf@milhouse.cs.cornell.edu>; from stodghil@cs.cornell.edu on Thu, Aug 23, 2001 at 12:28:16PM -0400

> The "assert" construct generates an exception which contains the file
> name and line number where the "assert" appears.

Character number, actually.

> 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
> output.

Right.  OCaml has a peculiar way of treating positions in source code:
on parsing, it remembers minimal information (absolute character
numbers in the input, regardless of # lineno "filename" directives),
and it's only when an error is detected that it re-scans the input to
convert the character numbers into file name + line number.

This works well for error reporting, but causes problems with
"assert", the compiler-generated "Match_failure" exceptions, and
certain uses of Camlp4.

All this will have to be addressed at some point, although it's rather
painful to do right.

Best regards,

- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


      parent reply	other threads:[~2001-08-28  7:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-23 16:28 Paul Stodghill
2001-08-23 16:59 ` Paul Stodghill
2001-08-28  7:31 ` Xavier Leroy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010828093100.B1759@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=stodghil@cs.cornell.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).