public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias.burnus@physik.fu-berlin.de>
To: Joseph Myers <joseph@codesourcery.com>
Cc: "Manuel López-Ibáñez" <lopezibanez@gmail.com>,
	gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org,
	"Jakub Jelinek" <jakub@redhat.com>
Subject: Re: [Patch, Fortran] PR68815 - replace '%s' quotes by %< ... %>
Date: Fri, 11 Dec 2015 10:00:00 -0000	[thread overview]
Message-ID: <20151211100003.GA26051@physik.fu-berlin.de> (raw)
In-Reply-To: <alpine.DEB.2.10.1512110002480.14974@digraph.polyomino.org.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;
 	    }

      reply	other threads:[~2015-12-11 10:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 15:53 Tobias Burnus
2015-12-09 18:16 ` Steve Kargl
2015-12-10 22:05 ` Manuel López-Ibáñez
2015-12-11  0:03   ` Joseph Myers
2015-12-11 10:00     ` Tobias Burnus [this message]

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=20151211100003.GA26051@physik.fu-berlin.de \
    --to=tobias.burnus@physik.fu-berlin.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=lopezibanez@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).