From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4818 invoked by alias); 11 Mar 2019 16:08:00 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 4550 invoked by uid 89); 11 Mar 2019 16:07:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=UD:error.c, errorc, ccing, error.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; Mon, 11 Mar 2019 16:07:58 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A55F30917AE; Mon, 11 Mar 2019 16:07:57 +0000 (UTC) Received: from ovpn-117-190.phx2.redhat.com (ovpn-117-190.phx2.redhat.com [10.3.117.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 729C960C55; Mon, 11 Mar 2019 16:07:56 +0000 (UTC) Message-ID: <1552320475.18132.15.camel@redhat.com> Subject: Re: How to add %' into gfc_fatal_error From: David Malcolm To: Martin =?UTF-8?Q?Li=C5=A1ka?= , GCC Development Cc: Martin Sebor , fortran@gcc.gnu.org Date: Mon, 11 Mar 2019 16:08:00 -0000 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-03/txt/msg00087.txt.bz2 On Mon, 2019-03-11 at 15:18 +0100, Martin Liška wrote: > Hi. > > I would like to add %' into __gcc_gfc__ in order to handle: > > ./xgcc -B. /tmp/module.ii -Wformat -c > /home/marxin/Programming/gcc/gcc/fortran/module.c: In function ‘void > dump_module(const char*, int)’: > /home/marxin/Programming/gcc/gcc/fortran/module.c:6205:19: warning: > unknown conversion type character ‘'’ in format [-Wformat=] > 6205 | gfc_fatal_error ("Can%'t delete module file %qs: %s", > filename, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Can you please help me how to do that? > Thanks, > Martin CCing the fortran mailing list. If I understand the question correctly, Martin: you're trying to fix the C++ frontend's c-family/c-format.c to correctly handle the format strings used within the Fortran frontend. I tried to consolidate the handling of pp_printf in c-format.c with r263181, but it looks like I missed gcc_gfc_char_table. I started looking at fixing that, but there appear to be two different kinds of format string within the Fortran frontend: (a) error_print/error_printf have their own format codes, implemented within fortran/error.c:error_print (b) gfc_fatal_error and many other entrypoints implemented within fortran/error.c, which call diagnostic_set_info to record the va_list, and then diagnostic_report_diagnostic. This uses the pretty_printer machinery. Most format codes are implemented by pp_printf, but it uses gfc_format_decoder to handle some more (which in turn calls default_tree_printer to handle others). Unfortunately, (a) and (b) accept different sets of format codes strings, but all of the declarations seem to be using ATTRIBUTE_GCC_GFC: both the (b) ones in gfortran.h, and the (a) ones which are internal to error.c So if I'm reading the code right, it seems there's an ambiguity here about what ATTRIBUTE_GCC_GFC means. Thoughts? Dave