diff mbox series

Fortran: Replace simple '.' quotes by %<.%>

Message ID 091af345-e484-7cca-e7df-b31bffbbe293@codesourcery.com
State New
Headers show
Series Fortran: Replace simple '.' quotes by %<.%> | expand

Commit Message

Tobias Burnus Dec. 9, 2022, 9:12 p.m. UTC
Found when working on the just submitted/committed patch.

I intent to commit it to mainline as obvious tomorrow (or Sun or Mon),
unless there are comments.

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
diff mbox series

Patch

Fortran: Replace simple '.' quotes by %<.%>

When using %qs instead of '%s' or %<=%> instead of '=' looks nicer
by having nicer quotes and bold text, if the terminal supports it;
otherwise, plain quotes are used.

gcc/fortran/ChangeLog:

	* match.cc (gfc_match_member_sep): Use %<...%> in gfc_error.
	* openmp.cc (gfc_match_oacc_routine, gfc_match_omp_context_selector,
	gfc_match_omp_context_selector_specification,
	gfc_match_omp_declare_variant, resolve_omp_clauses): Likewise;
	use %qs instead of '%s'.
	* primary.cc (match_real_constant, gfc_match_varspec): Likewise.
	* resolve.cc (gfc_resolve_formal_arglist, resolve_operator,
	resolve_ordinary_assign): Likewise.

diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc
index 7ba0f349993..89fb115c0f6 100644
--- a/gcc/fortran/match.cc
+++ b/gcc/fortran/match.cc
@@ -195,3 +195,3 @@  gfc_match_member_sep(gfc_symbol *sym)
       gfc_error ("Expected structure component or operator name "
-                 "after '.' at %C");
+		 "after %<.%> at %C");
       goto error;
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 4b4e6ac6947..7edc78ad0cb 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -4061,3 +4061,3 @@  gfc_match_oacc_routine (void)
 	  gfc_error ("Syntax error in !$ACC ROUTINE ( NAME ) at %C, expecting"
-		     " ')' after NAME");
+		     " %<)%> after NAME");
 	  gfc_current_locus = old_loc;
@@ -5350,4 +5350,4 @@  gfc_match_omp_context_selector (gfc_omp_set_selector *oss)
 		{
-		  gfc_error ("selector '%s' not allowed for context selector "
-			     "set '%s' at %C",
+		  gfc_error ("selector %qs not allowed for context selector "
+			     "set %qs at %C",
 			     selector, oss->trait_set_selector_name);
@@ -5370,3 +5370,3 @@  gfc_match_omp_context_selector (gfc_omp_set_selector *oss)
 	    {
-	      gfc_error ("selector '%s' does not accept any properties at %C",
+	      gfc_error ("selector %qs does not accept any properties at %C",
 			 selector);
@@ -5379,3 +5379,3 @@  gfc_match_omp_context_selector (gfc_omp_set_selector *oss)
 		{
-		  gfc_error ("expected '(' at %C");
+		  gfc_error ("expected %<(%> at %C");
 		  return MATCH_ERROR;
@@ -5401,3 +5401,3 @@  gfc_match_omp_context_selector (gfc_omp_set_selector *oss)
 		{
-		  gfc_error ("expected ')' at %C");
+		  gfc_error ("expected %<)%> at %C");
 		  return MATCH_ERROR;
@@ -5514,3 +5514,3 @@  gfc_match_omp_context_selector (gfc_omp_set_selector *oss)
 	    {
-	      gfc_error ("expected ')' at %C");
+	      gfc_error ("expected %<)%> at %C");
 	      return MATCH_ERROR;
@@ -5524,3 +5524,3 @@  gfc_match_omp_context_selector (gfc_omp_set_selector *oss)
 	    {
-	      gfc_error ("expected '(' at %C");
+	      gfc_error ("expected %<(%> at %C");
 	      return MATCH_ERROR;
@@ -5570,4 +5570,4 @@  gfc_match_omp_context_selector_specification (gfc_omp_declare_variant *odv)
 	{
-	  gfc_error ("expected 'construct', 'device', 'implementation' or "
-		     "'user' at %C");
+	  gfc_error ("expected %<constructs%>, %<device%>, %<implementation%> "
+		     "or %<user%> at %C");
 	  return MATCH_ERROR;
@@ -5578,3 +5578,3 @@  gfc_match_omp_context_selector_specification (gfc_omp_declare_variant *odv)
 	{
-	  gfc_error ("expected '=' at %C");
+	  gfc_error ("expected %<=%> at %C");
 	  return MATCH_ERROR;
@@ -5585,3 +5585,3 @@  gfc_match_omp_context_selector_specification (gfc_omp_declare_variant *odv)
 	{
-	  gfc_error ("expected '{' at %C");
+	  gfc_error ("expected %<{%> at %C");
 	  return MATCH_ERROR;
@@ -5600,3 +5600,3 @@  gfc_match_omp_context_selector_specification (gfc_omp_declare_variant *odv)
 	{
-	  gfc_error ("expected '}' at %C");
+	  gfc_error ("expected %<}%> at %C");
 	  return MATCH_ERROR;
@@ -5622,3 +5622,3 @@  gfc_match_omp_declare_variant (void)
     {
-      gfc_error ("expected '(' at %C");
+      gfc_error ("expected %<(%> at %C");
       return MATCH_ERROR;
@@ -5670,3 +5670,3 @@  gfc_match_omp_declare_variant (void)
     {
-      gfc_error ("expected ')' at %C");
+      gfc_error ("expected %<)%> at %C");
       return MATCH_ERROR;
@@ -5680,3 +5680,3 @@  gfc_match_omp_declare_variant (void)
 	    {
-	      gfc_error ("expected 'match' at %C");
+	      gfc_error ("expected %<match%> at %C");
 	      return MATCH_ERROR;
@@ -5689,3 +5689,3 @@  gfc_match_omp_declare_variant (void)
 	{
-	  gfc_error ("expected '(' at %C");
+	  gfc_error ("expected %<(%> at %C");
 	  return MATCH_ERROR;
@@ -5698,3 +5698,3 @@  gfc_match_omp_declare_variant (void)
 	{
-	  gfc_error ("expected ')' at %C");
+	  gfc_error ("expected %<)%> at %C");
 	  return MATCH_ERROR;
@@ -7380,3 +7380,3 @@  resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
 	    if (n->sym->mark == 1)
-	      gfc_error ("%qs specified in 'allocate' clause at %L but not "
+	      gfc_error ("%qs specified in %<allocate%> clause at %L but not "
 			 "in an explicit privatization clause",
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 19f2e78c8ff..21a8eb73c23 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -588,3 +588,3 @@  match_real_constant (gfc_expr **result, int signflag)
     {
-      if (!gfc_notify_std (GFC_STD_GNU, "exponent-letter 'q' in "
+      if (!gfc_notify_std (GFC_STD_GNU, "exponent-letter %<q%> in "
 			   "real-literal-constant at %C"))
@@ -2072,4 +2072,4 @@  gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
 	{
-	  gfc_error ("Array section designator, e.g. '(:)', is required "
-		     "besides the coarray designator '[...]' at %C");
+	  gfc_error ("Array section designator, e.g. %<(:)%>, is required "
+		     "besides the coarray designator %<[...]%> at %C");
 	  return MATCH_ERROR;
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 75dc4b59105..5f746d2244a 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -516,3 +516,3 @@  gfc_resolve_formal_arglist (gfc_symbol *proc)
 		 shall be specified, explicitly or implicitly, to be scalar.  */
-	      gfc_error ("Argument '%s' of statement function '%s' at %L "
+	      gfc_error ("Argument %qs of statement function %qs at %L "
 			 "must be scalar", sym->name, proc->name,
@@ -4383,4 +4383,4 @@  resolve_operator (gfc_expr *e)
 	    snprintf (msg, sizeof (msg),
-		      _("Unknown operator %%<%s%%> at %%L; did you mean '%s'?"),
-		      name, guessed);
+		      _("Unknown operator %%<%s%%> at %%L; did you mean "
+			"%%<%s%%>?"), name, guessed);
 	  else
@@ -8214,3 +8214,3 @@  check_symbols:
 	    {
-	      gfc_error ("Expected '*' in coindex specification in ALLOCATE "
+	      gfc_error ("Expected %<*%> in coindex specification in ALLOCATE "
 			 "statement at %L", &e->where);
@@ -11188,3 +11188,3 @@  resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
 		 "assignment at %L - check that there is a matching specific "
-		 "subroutine for '=' operator", &lhs->where);
+		 "subroutine for %<=%> operator", &lhs->where);
       return false;