This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to add %' into gfc_fatal_error


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]