From patchwork Mon Aug 15 21:05:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gab Charette X-Patchwork-Id: 110091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 5194DB6F76 for ; Tue, 16 Aug 2011 07:06:01 +1000 (EST) Received: (qmail 31763 invoked by alias); 15 Aug 2011 21:05:59 -0000 Received: (qmail 31754 invoked by uid 22791); 15 Aug 2011 21:05:58 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Aug 2011 21:05:44 +0000 Received: from hpaq14.eem.corp.google.com (hpaq14.eem.corp.google.com [172.25.149.14]) by smtp-out.google.com with ESMTP id p7FL5fRv013937; Mon, 15 Aug 2011 14:05:41 -0700 Received: from gchare.mtv.corp.google.com (gchare.mtv.corp.google.com [172.18.111.122]) by hpaq14.eem.corp.google.com with ESMTP id p7FL5dP2028058; Mon, 15 Aug 2011 14:05:40 -0700 Received: by gchare.mtv.corp.google.com (Postfix, from userid 138564) id 4F57B1C3650; Mon, 15 Aug 2011 14:05:39 -0700 (PDT) To: reply@codereview.appspotmail.com, crowl@google.com, dnovillo@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Forwarding trunk linemap changes (issue4898050) Message-Id: <20110815210539.4F57B1C3650@gchare.mtv.corp.google.com> Date: Mon, 15 Aug 2011 14:05:39 -0700 (PDT) From: gchare@google.com (Gabriel Charette) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Forwarding this patch to pph (which was just committed to trunk in issue4874043). Committed to pph branch. 2011-08-11 Gabriel Charette libcpp/ChangeLog * include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Remove. Update all users to use linemap_position_for_column instead. gcc/go/ChangeLog * gofrontend/lex.cc (Lex::location): Update to use linemap_position_for_column instead. (Lex::earlier_location): Likewise. --- This patch is available for review at http://codereview.appspot.com/4898050 diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc index 9f26911..167c7dd 100644 --- a/gcc/go/gofrontend/lex.cc +++ b/gcc/go/gofrontend/lex.cc @@ -518,9 +518,7 @@ Lex::require_line() source_location Lex::location() const { - source_location location; - LINEMAP_POSITION_FOR_COLUMN(location, line_table, this->lineoff_ + 1); - return location; + return linemap_position_for_column (line_table, this->lineoff_ + 1); } // Get a location slightly before the current one. This is used for @@ -529,9 +527,7 @@ Lex::location() const source_location Lex::earlier_location(int chars) const { - source_location location; - LINEMAP_POSITION_FOR_COLUMN(location, line_table, this->lineoff_ + 1 - chars); - return location; + return linemap_position_for_column (line_table, this->lineoff_ + 1 - chars); } // Get the next token. diff --git a/libcpp/directives-only.c b/libcpp/directives-only.c index e19f806..c6772af 100644 --- a/libcpp/directives-only.c +++ b/libcpp/directives-only.c @@ -142,7 +142,7 @@ _cpp_preprocess_dir_only (cpp_reader *pfile, flags |= DO_LINE_COMMENT; else if (!(flags & DO_SPECIAL)) /* Mark the position for possible error reporting. */ - LINEMAP_POSITION_FOR_COLUMN (loc, pfile->line_table, col); + loc = linemap_position_for_column (pfile->line_table, col); break; diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index f1d5bee..3c84035 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -165,23 +165,6 @@ extern const struct line_map *linemap_lookup /* Nonzero if the map is at the bottom of the include stack. */ #define MAIN_FILE_P(MAP) ((MAP)->included_from < 0) -/* Set LOC to a source position that is the same line as the most recent - linemap_line_start, but with the specified TO_COLUMN column number. */ - -#define LINEMAP_POSITION_FOR_COLUMN(LOC, SET, TO_COLUMN) do { \ - unsigned int to_column = (TO_COLUMN); \ - struct line_maps *set = (SET); \ - if (__builtin_expect (to_column >= set->max_column_hint, 0)) \ - (LOC) = linemap_position_for_column (set, to_column); \ - else { \ - source_location r = set->highest_line; \ - r = r + to_column; \ - if (r >= set->highest_location) \ - set->highest_location = r; \ - (LOC) = r; \ - }} while (0) - - extern source_location linemap_position_for_column (struct line_maps *set, unsigned int to_column); diff --git a/libcpp/lex.c b/libcpp/lex.c index d29f36d..d460b98 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -1975,8 +1975,8 @@ _cpp_lex_direct (cpp_reader *pfile) } c = *buffer->cur++; - LINEMAP_POSITION_FOR_COLUMN (result->src_loc, pfile->line_table, - CPP_BUF_COLUMN (buffer, buffer->cur)); + result->src_loc = linemap_position_for_column (pfile->line_table, + CPP_BUF_COLUMN (buffer, buffer->cur)); switch (c) {