https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79968

All,

The PR suggests unifying diagnostics of the form "%s at %C is a DEC
extension, enable with ..." I think the patch is obvious/trivial and
speaks for itself. I plan to commit the attached to trunk shortly,
barring any complaints.

(Nb. even with the change in diagnostics, the applicable testcases
(dec_io_3.f90 and dec_static_3.f90) are not regressed as they match
only the "is a DEC extension" portion of the error message.)

---
Fritz Reese

2017-05-17  Fritz Reese <fritzore...@gmail.com>

    PR fortran/79968

    gcc/fortran/ChangeLog:

        PR fortran/79968
        * decl.c (match_attr_spec, gfc_match_automatic,
        gfc_match_static, gfc_match_structure_decl): Unify diagnostic
        errors regarding -fdec options.
        * io.c (match_dec_etag, match_dec_vtag, match_dec_ftag): Ditto.
From de4f3b068eff1f33c0f7a8c9a5c328f6c85c712b Mon Sep 17 00:00:00 2001
From: Fritz Reese <fritzore...@gmail.com>
Date: Wed, 17 May 2017 11:36:54 -0400
Subject: [PATCH] 2017-05-17  Fritz Reese  <fore...@gcc.gnu.org>

	PR fortran/79968
	gcc/fortran/
	* decl.c (match_attr_spec, gfc_match_automatic,
	gfc_match_static, gfc_match_structure_decl): Unify diagnostic
	errors regarding -fdec options.
	* io.c (match_dec_etag, match_dec_vtag, match_dec_ftag): Ditto.
---
 gcc/fortran/decl.c | 18 ++++++++++++------
 gcc/fortran/io.c   | 12 ++++++------
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 5ca664e57a5..8d6c2064db4 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -4210,7 +4210,8 @@ match_attr_spec (void)
       if ((d == DECL_STATIC || d == DECL_AUTOMATIC)
 	  && !flag_dec_static)
 	{
-	  gfc_error ("%s at %L is a DEC extension, enable with -fdec-static",
+	  gfc_error ("%s at %L is a DEC extension, enable with "
+		     "%<-fdec-static%>",
 		     d == DECL_STATIC ? "STATIC" : "AUTOMATIC", &seen_at[d]);
 	  m = MATCH_ERROR;
 	  goto cleanup;
@@ -7889,8 +7890,10 @@ gfc_match_automatic (void)
 
   if (!flag_dec_static)
     {
-      gfc_error ("AUTOMATIC at %C is a DEC extension, enable with "
-		 "-fdec-static");
+      gfc_error ("%s at %C is a DEC extension, enable with "
+		 "%<-fdec-static%>",
+		 "AUTOMATIC"
+		 );
       return MATCH_ERROR;
     }
 
@@ -7943,7 +7946,9 @@ gfc_match_static (void)
 
   if (!flag_dec_static)
     {
-      gfc_error ("STATIC at %C is a DEC extension, enable with -fdec-static");
+      gfc_error ("%s at %C is a DEC extension, enable with "
+		 "%<-fdec-static%>",
+		 "STATIC");
       return MATCH_ERROR;
     }
 
@@ -8702,8 +8707,9 @@ gfc_match_structure_decl (void)
 
   if (!flag_dec_structure)
     {
-      gfc_error ("STRUCTURE at %C is a DEC extension, enable with "
-		 "-fdec-structure");
+      gfc_error ("%s at %C is a DEC extension, enable with "
+		 "%<-fdec-structure%>",
+		 "STRUCTURE");
       return MATCH_ERROR;
     }
 
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index 7ab897daa44..b08c785988d 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -1515,8 +1515,8 @@ match_dec_etag (const io_tag *tag, gfc_expr **e)
     return m;
   else if (m != MATCH_NO)
     {
-      gfc_error ("%s is a DEC extension at %C, re-compile with "
-	  "-fdec to enable", tag->name);
+      gfc_error ("%s at %C is a DEC extension, enable with "
+		 "%<-fdec%>", tag->name);
       return MATCH_ERROR;
     }
   return m;
@@ -1532,8 +1532,8 @@ match_dec_vtag (const io_tag *tag, gfc_expr **e)
     return m;
   else if (m != MATCH_NO)
     {
-      gfc_error ("%s is a DEC extension at %C, re-compile with "
-	  "-fdec to enable", tag->name);
+      gfc_error ("%s at %C is a DEC extension, enable with "
+		 "%<-fdec%>", tag->name);
       return MATCH_ERROR;
     }
   return m;
@@ -1553,8 +1553,8 @@ match_dec_ftag (const io_tag *tag, gfc_open *o)
 
   if (!flag_dec)
     {
-      gfc_error ("%s is a DEC extension at %C, re-compile with "
-		 "-fdec to enable", tag->name);
+      gfc_error ("%s at %C is a DEC extension, enable with "
+		 "%<-fdec%>", tag->name);
       return MATCH_ERROR;
     }
 
-- 
2.12.2

Reply via email to