From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27710 invoked by alias); 24 Sep 2004 01:40:15 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 27703 invoked from network); 24 Sep 2004 01:40:14 -0000 Received: from unknown (HELO bothner.com) (216.102.199.253) by sourceware.org with SMTP; 24 Sep 2004 01:40:14 -0000 Received: from [192.168.1.10] ([192.168.1.10]) (authenticated bits=0) by bothner.com (8.12.11/8.12.11) with ESMTP id i8O1mlL2022794 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 23 Sep 2004 18:48:48 -0700 Message-ID: <41537AFC.4070709@bothner.com> Date: Fri, 24 Sep 2004 02:08:00 -0000 From: Per Bothner User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.2) Gecko/20040803 MIME-Version: 1.0 To: gcc@gcc.gnu.org Subject: #pragma interface/implementation broken if --enable-mapped-location Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-09/txt/msg01374.txt.bz2 Some change in the last week or so broke support for #pragma interface/implementation in the --enable-mapped-location case. This breaks building libjava/java/lang/natClass.cc. What appears to be happening is this: The #pragma interface in Class.h is deferred until the current file (as given by input_location) is natClass.cc. At that point cp_lexer_handle_pragma calls cp_lexer_set_source_position_from_token, which nicely sets the input_location to the saved Class.h. After a few more calls we call do_pragms, but with the defer_pragmas flag turned off, so we get to: if (p && (p->is_internal || !CPP_OPTION (pfile, defer_pragmas))) { /* Since the handler below doesn't get the line number, that it might need for diagnostics, make sure it has the right numbers in place. */ if (pfile->cb.line_change) (*pfile->cb.line_change) (pfile, pragma_token, false); (*p->u.handler) (pfile); } The pragma_token has a location in natClass.cc even though the original (deferred) pragma was in Class.h. So the call to line_change sets the input_location to the location in natClass.cc, undoing the effect of cp_lexer_set_source_position_from_token. Hence the #pragma interface doesn't work. The same thing happens in the --disable-mapped-location case, but it happens to "accidentally" work: In that case the cb_line_change function (in c-lex.c) just changes the input_line, leaving the input_filename unchanged. The resulting input_location is non-sensical, but #pragma interface doesn't care. My quick-and-dirty fix to remove the cb.line_change call. I'll try rebuilding with that. Zack, how do you want to handle this? -- --Per Bothner per@bothner.com http://per.bothner.com/