This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[patch, fortran] PR24633, improve diagnostic message


Subroutines or functions named as their containing module or program are 
reported as

subroutine abc()
             1
Error: MODULE attribute conflicts with PROCEDURE attribute at (1)

Attached patch checks whether a NAME is available. If yes, it is added to the 
message:

subroutine abc()
             1
Error: MODULE attribute of 'abc' conflicts with PROCEDURE attribute at (1)

A similar distinction as the one proposed is made in symbol.c:602.


:ADDPATCH fortran:

2007-04-30  Daniel Franke  <franke.daniel@gmail.com>

	* symbol.c (gfc_add_flavor): Add the NAME to error message if available.


As it is a minor clarification within a message only, no additional testcase 
is included.

Tested on i686-pc-linux-gnu, no regressions. Ok for mainline?

	Daniel


P.S. In general, should changes like this be backported to 4.2(.1) as well, 
although they are not actually regressions?
Index: symbol.c
===================================================================
--- symbol.c	(revision 124274)
+++ symbol.c	(working copy)
@@ -1155,9 +1155,14 @@
       if (where == NULL)
 	where = &gfc_current_locus;
 
-      gfc_error ("%s attribute conflicts with %s attribute at %L",
-		 gfc_code2string (flavors, attr->flavor),
-		 gfc_code2string (flavors, f), where);
+      if (name)
+        gfc_error ("%s attribute of '%s' conflicts with %s attribute at %L",
+		   gfc_code2string (flavors, attr->flavor), name,
+		   gfc_code2string (flavors, f), where);
+      else
+        gfc_error ("%s attribute conflicts with %s attribute at %L",
+		   gfc_code2string (flavors, attr->flavor),
+		   gfc_code2string (flavors, f), where);
 
       return FAILURE;
     }

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