From patchwork Fri Jun 3 11:24:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marcin_Baczy=C5=84ski?= X-Patchwork-Id: 629770 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rLhZp3kNcz9snk for ; Fri, 3 Jun 2016 21:24:49 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=qhXj5f4k; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=GjxC8g+jHg4t c0LnhGjQ2mZ8lFzHj43guBEE8HRERLk5zqqbUbUanwmfXPk2tEJkTB85El+5DJP4 Bld4Ha7pxFr5xAcS+tm0AuFZRUJS0N9ZH/jizHGyTikariyMcAI/OPStcJPXAsXv k2VBuzXQFDZe6HpBED4rmueHpUNGDT4= 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:from :to:cc:subject:date:message-id; s=default; bh=ARXeF3Bs0isln9rBEe O2E6eR99Q=; b=qhXj5f4k/ug7PNWyKGbEXR3uYddb9GjGP9tYmox8o+ejUfcyZt XJ51M+RL0IlfeHDwYXXElrhxuIN4kcSRrLl9pJ+hBLZKzKRHftanlhs3v+JMeEHZ maP+0PW3vWOXijpj3cQAdFqxInI/lpzfp+8SFQQtyAYr8suPD8+C9m3gI= Received: (qmail 96838 invoked by alias); 3 Jun 2016 11:24:41 -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 96822 invoked by uid 89); 3 Jun 2016 11:24:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=ch, ah, bh, Hx-languages-length:2253 X-HELO: mail-lf0-f65.google.com Received: from mail-lf0-f65.google.com (HELO mail-lf0-f65.google.com) (209.85.215.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 03 Jun 2016 11:24:38 +0000 Received: by mail-lf0-f65.google.com with SMTP id 65so7706806lfq.1 for ; Fri, 03 Jun 2016 04:24:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iGzBtvd7V3i0YczikWaxo4QUdhPBAw19RZhl+7D/2OE=; b=HN+Uhbdv2YvpSLGznbuMlZYV28A9N0jxdaSRY7/JBfhGBzAWjj452nbZ704uTA9li9 6bdBH4FUoVePGH9e/F3KNAlfkXlJyLa5OXxIsfWYQhCfRhUL+KBzYW49rl0xrI7bUdVs /MTIlx/PY+vyxhnLSx7D9VCHo7hwk/cD7Y18inT/jd4XM3ENYab30Yjh2G8JMkLVqLyl sBqU9MArVZek3RSXtLOKWMX2+vCkKzjdkkQauABz+Rf9RKsZ5Ji/9xJJCRGEK1TPKRsM LHi8/DAlqVWDShE5WxW0XqenuVGJbd+L6Mb1q438xbWFPCciu0W1pQbPYtIcCz9Xy6KH Xf0g== X-Gm-Message-State: ALyK8tIlYpGBaBTfXRtnj9V8KjvpyNryvJaH3TB3ltt3xbN2SL+Fg4xVXGcxdco6ZJtfDA== X-Received: by 10.25.81.18 with SMTP id f18mr916172lfb.78.1464953075436; Fri, 03 Jun 2016 04:24:35 -0700 (PDT) Received: from localhost.localdomain (89-74-110-56.dynamic.chello.pl. [89.74.110.56]) by smtp.googlemail.com with ESMTPSA id rt5sm489846lbb.43.2016.06.03.04.24.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Jun 2016 04:24:34 -0700 (PDT) From: =?UTF-8?q?Marcin=20Baczy=C5=84ski?= To: gcc-patches@gcc.gnu.org Cc: =?UTF-8?q?Marcin=20Baczy=C5=84ski?= Subject: [PATCH] Print column numbers in inclusion trace consistently. Date: Fri, 3 Jun 2016 13:24:25 +0200 Message-Id: <20160603112425.189703-1-marbacz@gmail.com> Hi, the patch below fixes PR/42014. Although the fix itself seems easy enough, I have a problem with the test. Is there a way to match the output before the "warning:" line? dg-{begin,end}-multiline-output doesn't do the job, or at least I don't know how to convince it. Bootstrapped on x86_64 linux. Thanks, Marcin gcc/ChangeLog: PR/42014 * diagnostic.c (diagnostic_report_current_module): Print column numbers for all mentioned files if context->show_column. gcc/testsuite/ChangeLog: PR/42014 * gcc.dg/inclusion-trace-column.i: New test. --- gcc/diagnostic.c | 12 +++++++++--- gcc/testsuite/gcc.dg/inclusion-trace-column.i | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/inclusion-trace-column.i diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 8106172..05037ba 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -537,9 +537,15 @@ diagnostic_report_current_module (diagnostic_context *context, location_t where) while (! MAIN_FILE_P (map)) { map = INCLUDED_FROM (line_table, map); - pp_verbatim (context->printer, - ",\n from %r%s:%d%R", "locus", - LINEMAP_FILE (map), LAST_SOURCE_LINE (map)); + if (context->show_column) + pp_verbatim (context->printer, + ",\n from %r%s:%d:%d%R", "locus", + LINEMAP_FILE (map), + LAST_SOURCE_LINE (map), LAST_SOURCE_COLUMN (map)); + else + pp_verbatim (context->printer, + ",\n from %r%s:%d%R", "locus", + LINEMAP_FILE (map), LAST_SOURCE_LINE (map)); } pp_verbatim (context->printer, ":"); pp_newline (context->printer); diff --git a/gcc/testsuite/gcc.dg/inclusion-trace-column.i b/gcc/testsuite/gcc.dg/inclusion-trace-column.i new file mode 100644 index 0000000..1fb8923 --- /dev/null +++ b/gcc/testsuite/gcc.dg/inclusion-trace-column.i @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fshow-column -Wreturn-type" } */ +/* { dg-begin-multiline-output "" } +In file included from b.h:1:0, + from a.h:1:0, + from t.c:1:0: + { dg-end-multiline-output "" } */ +/* PR 42014 */ +# 1 "t.c" +# 1 "a.h" 1 +# 1 "b.h" 1 +# 1 "c.h" 1 +double f () {} /* { dg-warning "reaches end" "no return" { target *-*-* } 1 } */ +# 1 "b.h" 2 +# 1 "a.h" 2 +# 1 "t.c" 2