From patchwork Tue Nov 22 15:38:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 697754 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 3tNV4d6VqMz9svs for ; Wed, 23 Nov 2016 02:38:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="CMhhC+6q"; 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 :message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version; q=dns; s=default; b=CPNp5lBBk8m/mpSU b6o0DD0YptCoG0dLTvlBXsEG0rf3ShqL+l18EhdCtFgXv2dLInGLzjCQYiUawrDg 0YZJ15VcYtFh8J7qjpf+flz/FG5bIWf5Elamx4xZrHEyhsb/YtlIX6Zu3xM/8BBE lPNN5EQ+aik77eQ4f8xuKdGbffM= 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 :message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version; s=default; bh=UlRQoDtXrYnqoLD8FtgCYe yMhi8=; b=CMhhC+6qPm9MvjTpR+aAbD/AkIpgWCkE1b4wX8341RnRxLHPQgWNoT M5f2l+qttojuega1wNAaPnR6q5EZL9GjdFdfgyAt2btcVEZozwe/crkU7Uk4c82w VcHSW+lEDIoatH769Cd9gZmCsgCkuJ0hbpfIIy2aPqsk8+0QxgTjM= Received: (qmail 112624 invoked by alias); 22 Nov 2016 15:38:48 -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 111644 invoked by uid 89); 22 Nov 2016 15:38:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00, MIME_BASE64_BLANKS, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:dmalcol, printrtlc, print-rtl.c, UD:print-rtl.c X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Nov 2016 15:38:46 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 851BC804FE; Tue, 22 Nov 2016 15:38:45 +0000 (UTC) Received: from vpn-226-206.phx2.redhat.com (vpn-226-206.phx2.redhat.com [10.3.226.206]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAMFchq4014757; Tue, 22 Nov 2016 10:38:44 -0500 Message-ID: <1479829122.7673.83.camel@redhat.com> Subject: Re: [PATCH] (v2) Add a "compact" mode to print_rtx_function From: David Malcolm To: Jakub Jelinek , Bernd Schmidt Cc: vogt@linux.vnet.ibm.com, gcc-patches@gcc.gnu.org Date: Tue, 22 Nov 2016 10:38:42 -0500 In-Reply-To: <20161122144501.GU3541@tucnak.redhat.com> References: <43d4ec20-5f84-2533-22e4-e16c779f6162@redhat.com> <1476304646-39819-1-git-send-email-dmalcolm@redhat.com> <20161122131836.GA7025@linux.vnet.ibm.com> <48811c08-6412-2e8b-2763-b163c358afe3@redhat.com> <20161122133750.GR3541@tucnak.redhat.com> <20161122144501.GU3541@tucnak.redhat.com> Mime-Version: 1.0 X-IsSubscribed: yes On Tue, 2016-11-22 at 15:45 +0100, Jakub Jelinek wrote: > On Tue, Nov 22, 2016 at 03:38:04PM +0100, Bernd Schmidt wrote: > > On 11/22/2016 02:37 PM, Jakub Jelinek wrote: > > > Can't it be done only if xloc.file contains any fancy characters? > > > > Sure, but why? Strings generally get emitted with quotes around > > them, I > > don't see a good reason for filenames to be different, especially > > if it > > makes the output easier to parse. > > Because printing common filenames matches what we emit in > diagnostics, > what e.g. sanitizers emit at runtime diagnostics, what we emit as > locations > in gimple dumps etc. It sounds like a distinction between human-readable vs machine -readable. How about something like the following, which only adds the quotes if outputting the RTL FE's input format? Does this fix the failing tests? From 642d511fdba3a33fb18ce46c549f7c972ed6b14e Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 22 Nov 2016 11:06:41 -0500 Subject: [PATCH] print-rtl.c: conditionalize quotes for filenames gcc/ChangeLog: * print-rtl.c (rtx_writer::print_rtx_operand_code_i): Only use quotes for filenames when in compact mode. --- gcc/print-rtl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index 77e6b05..5370602 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -371,7 +371,10 @@ rtx_writer::print_rtx_operand_code_i (const_rtx in_rtx, int idx) if (INSN_HAS_LOCATION (in_insn)) { expanded_location xloc = insn_location (in_insn); - fprintf (m_outfile, " \"%s\":%i", xloc.file, xloc.line); + if (m_compact) + fprintf (m_outfile, " \"%s\":%i", xloc.file, xloc.line); + else + fprintf (m_outfile, " %s:%i", xloc.file, xloc.line); } #endif } -- 1.8.5.3