From patchwork Sat Jun 1 14:55:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 248081 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 37AC62C0090 for ; Sun, 2 Jun 2013 00:55:30 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=A6vUgUCokf3YzDHtLlnTCsiI+lc9D9C1ArEG7ahKmfw zR3h/IDecF5gAUBl5eZFIDsK705mXkJqW2txs42t8js0iWt0qI63kLyLcP2NasAf khwXnVzVTh4mpxi+fxsstc4UmQIRVavHl1uqzopTlzg132BS0SxT5dqCK+EYKDdI = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=NXohYAq2c9vLT5GKPiNL7CjACes=; b=EXhAC6oP8h29Yb873 HuEX8NF2iq7N66uRNtGIkksSMOMVTtu9+4fWB25fC7xa0VgtrbyiP27tA8oD1xry gPzUhLhSu+EZ+jvEgfEZvNxjIeJpfxjkyYFU2Sdtw2d2k8FYGDc4wmy8+APKH9W2 otPdKlRoBOpUxwpo8/xsDl+sfw= Received: (qmail 10526 invoked by alias); 1 Jun 2013 14:55:24 -0000 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 Received: (qmail 10517 invoked by uid 89); 1 Jun 2013 14:55:24 -0000 X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-ee0-f54.google.com (HELO mail-ee0-f54.google.com) (74.125.83.54) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 01 Jun 2013 14:55:23 +0000 Received: by mail-ee0-f54.google.com with SMTP id b45so454208eek.41 for ; Sat, 01 Jun 2013 07:55:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=wiJgOgG8GFN6lUlbgJ7M2ZtKM8xQWugUK5MHXKZGzYE=; b=neGkdQffFdfvYTcA2/0Hxc0B1ITYCvuduTsIpqc4Uq7gYdr7EdRc+UIoJQLz7p1X5A VS9O0muwnAVJJGLLuJhU00SS0a2A/grI8Z318ttLfTQhixJLQhsDFL1sfRxD1evMnRm4 v3glDhehqvbBZIGAHUn9c6sC8IPfayReTsHOQpVaETwQc67q83MpSClwkP64QFC9QQdV g75/+FtGpU1qYXhrEUnevKLVkhiHGcYUVFABc98Wuxa+uBlxW4NmScad0jPJw48QkDat KBIg7MQ8AVRP4JTYBPjnOzNKFHs8PlMWd7MrT3/+LVi53xJ9cm536bOvQ8TdUmHe1cgE L0gw== MIME-Version: 1.0 X-Received: by 10.15.43.71 with SMTP id w47mr17091119eev.32.1370098521442; Sat, 01 Jun 2013 07:55:21 -0700 (PDT) Received: by 10.14.220.9 with HTTP; Sat, 1 Jun 2013 07:55:21 -0700 (PDT) Date: Sat, 1 Jun 2013 07:55:21 -0700 Message-ID: Subject: [PATCH, libcpp] Do not decrease highest_location if the included file has be included twice. From: Dehao Chen To: GCC Patches Cc: Richard Biener X-Gm-Message-State: ALoCoQmRrCxXLpWO+75pfSyTaBsqZ9M78WeWFZp1G9WmmGdkwBM4dObqIvJA3anJ92Aqv/JbjgrRFD/RMMtyrbE5MKXp3C0IGK0Vikp3y2Q5tIyTl+vF7Ue2LyNu/lyCwXd31sOPPduyCVstR8g8WSkBwzsr5zsOuybuIaK1HXgCreqZmUYZzRfdzsZOaiQlOtyxLpIQsd2d This patch fixes the bug that when include a header file, if the header file is already included (with #define _HEADER_H_), libcpp should not decrease its highest_location, otherwise it'll cause incorrect source location when source location numbers are large enough to omit columns. Passed regression test. OK for trunk? Thanks, Dehao libcpp/ChangeLog: 2013-05-31 Dehao Chen * files.c (_cpp_stack_include): Fix the highest_location when header file is guarded by #ifndef and is included twice. Index: libcpp/files.c =================================================================== --- libcpp/files.c (revision 199416) +++ libcpp/files.c (working copy) @@ -1002,7 +1002,8 @@ _cpp_stack_include (cpp_reader *pfile, const char linemap_add is not called) or we were included from the command-line. */ if (file->pchname == NULL && file->err_no == 0 - && type != IT_CMDLINE && type != IT_DEFAULT) + && type != IT_CMDLINE && type != IT_DEFAULT + && !(file->cmacro && file->cmacro->type == NT_MACRO)) pfile->line_table->highest_location--; return _cpp_stack_file (pfile, file, type == IT_IMPORT);