This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] PR24633, improve diagnostic message
- From: Daniel Franke <franke dot daniel at gmail dot com>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 30 Apr 2007 12:58:45 +0200
- Subject: [patch, fortran] PR24633, improve diagnostic message
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:to:subject:date:user-agent:mime-version:content-type:message-id; b=eI17U7CMDD507Ju7eE3wSxygslalLdLhPj9/iWPZPLRLl5SDMLT5gXWo2AlOnGc0lpdwzcn6+bnQaM3I6h4PyjLAyIh2u6u/fc2aRXU8dZ+jD36xWgICe+XeNEPT6Yme01Fbj9hl8PqrgOy8VrarmPsc697rlWn+7Wcth1oqXN8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:to:subject:date:user-agent:mime-version:content-type:message-id; b=oXNchgIFxL9x1vgDdBI6r4yPX8OVz5DoIsWlkXOJSPkis79/E4SC2rOFyZSdXhuadh612thLfZc+Achu9p/FnlzDfSKLzLF1LsuEBYV8P3m8obuKTclNlfBRmNBLDxRrI5pzSlIWvOro2ndxVqQ8jTpd7C2LOX1GSGr5j/sJ6rg=
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;
}