This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PR68815 - replace '%s' quotes by %< ... %>
- From: Tobias Burnus <tobias dot burnus at physik dot fu-berlin dot de>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: Manuel López-Ibáñez <lopezibanez at gmail dot com>, gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org, Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 11 Dec 2015 11:00:03 +0100
- Subject: Re: [Patch, Fortran] PR68815 - replace '%s' quotes by %< ... %>
- Authentication-results: sourceware.org; auth=none
- References: <20151209155337 dot GA6991 at physik dot fu-berlin dot de> <5669F722 dot 6000902 at gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1512110002480 dot 14974 at digraph dot polyomino dot org dot uk>
On Fri, Dec 11, 2015 at 12:03:26AM +0000, Joseph Myers wrote:
> On Thu, 10 Dec 2015, Manuel López-Ibáñez wrote:
> > On 12/09/2015 03:53 PM, Tobias Burnus wrote:
> > > In principle, %<%c%> and %<%d%> should be convertable to %qc and
> > > %qd (as the code is more readable), but the current function
> > > annotation prevent this, telling that the q flag is not valid for
> > > %c and %d. As %< is fine, I didn't dig into it.
> >
> > You need to edit the gcc_gfc_* variables in c-family/c-format.c. [...]
>
> Put "q" in the first flags string for those formats in gcc_gfc_char_table.
Thanks! The attached patch works :-)
Build and regtested on x86-64-gnu-linux.
I will commit it tomorrow, unless there are comments or objections.
Tobias
gcc/c-family/
PR fortran/68815
* c-format.c (gcc_gfc_char_table): Add 'q' flag to remaining
specifiers (%d, %i,%u and %c).
gcc/fortran/
PR fortran/68815
* check.c (gfc_check_reshape): Replace %<%d%> by %qd.
* matchexp.c (gfc_match_defined_op_name): Use %qc.
* symbol.c (gfc_add_new_implicit_range,
gfc_merge_new_implicit): Ditto.
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index 6e37265..de07b6c 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -809,9 +809,9 @@ static const format_char_info gcc_cxxdiag_char_table[] =
static const format_char_info gcc_gfc_char_table[] =
{
/* C89 conversion specifiers. */
- { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "", NULL },
- { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "", NULL },
- { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "", NULL },
+ { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
+ { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
+ { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
{ "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "cR", NULL },
/* gfc conversion specifiers. */
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 6dc7f3e..3f1bdd3 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -3863,7 +3863,7 @@ gfc_check_reshape (gfc_expr *source, gfc_expr *shape,
{
gfc_error ("%qs argument of %qs intrinsic at %L has "
"invalid permutation of dimensions (dimension "
- "%<%d%> duplicated)",
+ "%qd duplicated)",
gfc_current_intrinsic_arg[3]->name,
gfc_current_intrinsic, &e->where, dim);
return false;
diff --git a/gcc/fortran/matchexp.c b/gcc/fortran/matchexp.c
index 02f43a0..c14ef59 100644
--- a/gcc/fortran/matchexp.c
+++ b/gcc/fortran/matchexp.c
@@ -69,7 +69,7 @@ gfc_match_defined_op_name (char *result, int error_flag)
for (i = 0; name[i]; i++)
if (!ISALPHA (name[i]))
{
- gfc_error ("Bad character %<%c%> in OPERATOR name at %C", name[i]);
+ gfc_error ("Bad character %qc in OPERATOR name at %C", name[i]);
return MATCH_ERROR;
}
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 221fef3..d241bc0 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -166,7 +166,7 @@ gfc_add_new_implicit_range (int c1, int c2)
{
if (new_flag[i])
{
- gfc_error ("Letter %<%c%> already set in IMPLICIT statement at %C",
+ gfc_error ("Letter %qc already set in IMPLICIT statement at %C",
i + 'A');
return false;
}
@@ -198,7 +198,7 @@ gfc_merge_new_implicit (gfc_typespec *ts)
{
if (gfc_current_ns->set_flag[i])
{
- gfc_error ("Letter %c already has an IMPLICIT type at %C",
+ gfc_error ("Letter %qc already has an IMPLICIT type at %C",
i + 'A');
return false;
}