public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: "Martin Liška" <mliska@suse.cz>, "GCC Development" <gcc@gcc.gnu.org>
Cc: Martin Sebor <msebor@gmail.com>, fortran@gcc.gnu.org
Subject: Re: How to add %' into gfc_fatal_error
Date: Mon, 11 Mar 2019 16:08:00 -0000	[thread overview]
Message-ID: <1552320475.18132.15.camel@redhat.com> (raw)
In-Reply-To: <aaf5a50d-b311-8fe6-c6ed-c26d432c9df5@suse.cz>

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

  parent reply	other threads:[~2019-03-11 16:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-11 14:18 Martin Liška
2019-03-11 15:55 ` Martin Sebor
2019-03-12 20:54   ` Eric Gallager
2019-03-11 16:08 ` David Malcolm [this message]
2019-03-11 17:23   ` Steve Kargl
2019-03-12 11:15     ` Martin Liška
2019-03-12 14:17       ` Steve Kargl
2019-03-12 15:09         ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1552320475.18132.15.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=mliska@suse.cz \
    --cc=msebor@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).