From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA02194; Tue, 28 Aug 2001 09:31:03 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA02234 for ; Tue, 28 Aug 2001 09:31:03 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f7S7V0D24692; Tue, 28 Aug 2001 09:31:00 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA01987; Tue, 28 Aug 2001 09:31:00 +0200 (MET DST) Date: Tue, 28 Aug 2001 09:31:00 +0200 From: Xavier Leroy To: Paul Stodghill Cc: caml-list@inria.fr Subject: Re: [Caml-list] assert + -pp = wrong line number and filename in assert message Message-ID: <20010828093100.B1759@pauillac.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from stodghil@cs.cornell.edu on Thu, Aug 23, 2001 at 12:28:16PM -0400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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