From patchwork Mon Oct 20 14:11:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= X-Patchwork-Id: 401138 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 88C7E14001A for ; Tue, 21 Oct 2014 01:12:39 +1100 (AEDT) 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:from:date:message-id:subject:to:content-type; q= dns; s=default; b=Qb/vHNQFGB3OqM2JExWoiDB+cwpgNUhxExxO7dqO3M9JDL ks16SLPy8WX8+a5l+2oOmzTLDUUKOtN2GcY0bzkDYIfWpw+/UOFh4igB0Fny5iSN hucPUILxu5FRX6cIUhbOFom769vMcROAslC2msJaYQZFXEvAjwK0FWB14sr3k= 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:from:date:message-id:subject:to:content-type; s= default; bh=NE5bBtCu6k6XEqtyfLZNP6WzkGw=; b=XLhwHVNm+xuVbsXJNM54 3MU33QMXKNEi70zwfS6YpsJN/+L30Oa77AakMZK8KZxOzmmviRODye6p2F42QYX+ bT+/Y1YODpYXnrdF4VJF5rTkRXhebkxaQYD90gb4DycLze6dL+Hff+INL0UNF0w7 97QZRRt+UhyptkCI4RmB/ek= Received: (qmail 5094 invoked by alias); 20 Oct 2014 14:12:00 -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 5038 invoked by uid 89); 20 Oct 2014 14:11:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f51.google.com Received: from mail-wg0-f51.google.com (HELO mail-wg0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 20 Oct 2014 14:11:58 +0000 Received: by mail-wg0-f51.google.com with SMTP id b13so5552470wgh.22 for ; Mon, 20 Oct 2014 07:11:55 -0700 (PDT) X-Received: by 10.194.175.67 with SMTP id by3mr33352719wjc.32.1413814313090; Mon, 20 Oct 2014 07:11:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.217.80.73 with HTTP; Mon, 20 Oct 2014 07:11:32 -0700 (PDT) From: =?ISO-8859-1?Q?Manuel_L=F3pez=2DIb=E1=F1ez?= Date: Mon, 20 Oct 2014 16:11:32 +0200 Message-ID: Subject: Re: [PATCH] PR preprocessor/42014 To: Gcc Patch List , Krzesimir Nowak > 2014-10-18 23:07 GMT+02:00 Krzesimir Nowak : >> Hello. >> >> This is my first patch for GCC. I already started a paperwork for >> copyright assignment (sent an email to fsf-records at gnu org) - >> waiting for response. >> >> So, about this patch - it basically removes column printing from "In >> file included from ..." lines, as the column information always >> returned 0. Not sure if this is correct assumption - I tested only C >> and C++, so I don't know if other frontends (ada, go?) provide column >> information for include lines. Anyway, column information here is >> probably not useful. >> >> Or maybe it is, if GCC supports some language with include syntax like >> followish: >> #include , , >> >> Maybe in this case printing column number has sense? >> >> I need help with testcase - I don't know how to implement it >> correctly. The output of compilation is something like this: >> >> In file included from .../pr42014-2.h:2, >> from .../pr42014-1.h:3, >> from .../pr42014.c:4: >> .../pr42014-3.h:1:7: error: 'foo' was not declared in this scope >> >> How to check the "from" lines? Is there some dg-foo (dg-grep?) command >> for it? dg-excess-errors is likely not suited for this purpose. > > I suppose I will have to add a preprocessed file and try using dg-message. Hi Krzesimir, I think you are overcomplicating it. The original reporter complained simply that there is an inconsistency between the first line and the next ones when -fshow-column is enabled (which is now the default but it wasn't some years ago). The following patch is sufficient to fix this inconsistency: You can test this by simply building gcc and using -fshow-column vs. -fno-show-column. I think a testsuite testcase will be hard to build because DejaGNU. It doesn't seem worth the effort for such a minor issue. Given that you seem to have enough knowledge and ability to modify GCC and submit good patches, it would be better to spend your time on more important bugs. For example, this one needs to be analyzed, we don't even know how it happens: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52998 Or this one, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45333 which I think is just a matter of adding (or factoring out) some of the logic from maybe_unwind_expanded_macro_loc() and use it in various places in cp/error.c (print_instantiation_*). If you are not motivated by those, I can offer more suggestions... Cheers, Manuel. Index: diagnostic.c =================================================================== --- diagnostic.c (revision 216462) +++ diagnostic.c (working copy) @@ -528,8 +528,8 @@ if (context->show_column) pp_verbatim (context->printer, "In file included from %r%s:%d:%d%R", "locus", - LINEMAP_FILE (map), - LAST_SOURCE_LINE (map), LAST_SOURCE_COLUMN (map)); + LINEMAP_FILE (map), LAST_SOURCE_LINE (map), + LAST_SOURCE_COLUMN (map)); else pp_verbatim (context->printer, "In file included from %r%s:%d%R", "locus", @@ -537,9 +537,15 @@ 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);