public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/110003] New: Wrong source line listed for unused parameters
@ 2023-05-27 15:03 admin@tho-otto.de
2023-06-03 12:53 ` [Bug modula2/110003] " gaius at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: admin@tho-otto.de @ 2023-05-27 15:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110003
Bug ID: 110003
Summary: Wrong source line listed for unused parameters
Product: gcc
Version: 13.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: modula2
Assignee: gaius at gcc dot gnu.org
Reporter: admin@tho-otto.de
Target Milestone: ---
When compiling a module with -Wall and a parameter in the in implementation
module is unused, the error message lists the source line of the definition
module instead:
DEFINITION MODULE foo;
PROCEDURE bla(a: INTEGER);
END foo.
IMPLEMENTATION MODULE foo;
PROCEDURE bla(a: INTEGER);
BEGIN
END bla;
END foo.
$ gm2 -c -Wall foo.mod
./foo.def:3:15: warning: In procedure 'bla': unused parameter 'a' in procedure
'bla'
3 | PROCEDURE bla(a: INTEGER);
| ^
That information is rather useless, because an unused parameter can only be
unused in the implementation.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/110003] Wrong source line listed for unused parameters
2023-05-27 15:03 [Bug modula2/110003] New: Wrong source line listed for unused parameters admin@tho-otto.de
@ 2023-06-03 12:53 ` gaius at gcc dot gnu.org
2023-06-03 14:18 ` gaius at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-06-03 12:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110003
Gaius Mulley <gaius at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-06-03
Status|UNCONFIRMED |ASSIGNED
--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Confirmed, thank you for the bug report.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/110003] Wrong source line listed for unused parameters
2023-05-27 15:03 [Bug modula2/110003] New: Wrong source line listed for unused parameters admin@tho-otto.de
2023-06-03 12:53 ` [Bug modula2/110003] " gaius at gcc dot gnu.org
@ 2023-06-03 14:18 ` gaius at gcc dot gnu.org
2023-06-03 14:28 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-06-03 14:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110003
Gaius Mulley <gaius at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gaius at gcc dot gnu.org
--- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 55248
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55248&action=edit
Proposed fix
Here is a proposed patch which directs the unused parameter warning to the
implementation module.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/110003] Wrong source line listed for unused parameters
2023-05-27 15:03 [Bug modula2/110003] New: Wrong source line listed for unused parameters admin@tho-otto.de
2023-06-03 12:53 ` [Bug modula2/110003] " gaius at gcc dot gnu.org
2023-06-03 14:18 ` gaius at gcc dot gnu.org
@ 2023-06-03 14:28 ` cvs-commit at gcc dot gnu.org
2023-06-03 14:29 ` gaius at gcc dot gnu.org
2023-07-29 12:48 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-03 14:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110003
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>:
https://gcc.gnu.org/g:7c0e2159afb3235950d3d8f61ef085cd1ccf0dfc
commit r14-1520-g7c0e2159afb3235950d3d8f61ef085cd1ccf0dfc
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date: Sat Jun 3 15:27:58 2023 +0100
PR modula2/110003 Wrong source line listed for unused parameters
Ensure that the parameter token position is recorded for both
definition and implementation modules. The shadow variable
is created inside BuildFormalParameterSection. The shadow
variable needs to have the other definition or implementation module
token position set when CheckFormalParameterSection is called.
This allows the MetaError family of procedures to request the
implementation module token position when reporting unused parameters.
gcc/m2/ChangeLog:
PR modula2/110003
* gm2-compiler/P2SymBuild.mod (GetParameterShadowVar): Import.
(CheckFormalParameterSection): Call PutDeclared for the shadow
variable associated with the parameter.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/110003] Wrong source line listed for unused parameters
2023-05-27 15:03 [Bug modula2/110003] New: Wrong source line listed for unused parameters admin@tho-otto.de
` (2 preceding siblings ...)
2023-06-03 14:28 ` cvs-commit at gcc dot gnu.org
@ 2023-06-03 14:29 ` gaius at gcc dot gnu.org
2023-07-29 12:48 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-06-03 14:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110003
Gaius Mulley <gaius at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #4 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Closing now that the patch has been applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/110003] Wrong source line listed for unused parameters
2023-05-27 15:03 [Bug modula2/110003] New: Wrong source line listed for unused parameters admin@tho-otto.de
` (3 preceding siblings ...)
2023-06-03 14:29 ` gaius at gcc dot gnu.org
@ 2023-07-29 12:48 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-29 12:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110003
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Gaius Mulley
<gaius@gcc.gnu.org>:
https://gcc.gnu.org/g:6ace58a7241d500a9f57521a581d59f7a2f8b9fd
commit r13-7641-g6ace58a7241d500a9f57521a581d59f7a2f8b9fd
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date: Sat Jul 29 13:48:22 2023 +0100
PR modula2/110003 Wrong source line listed for unused parameters
Ensure that the parameter token position is recorded for both
definition and implementation modules. The shadow variable
is created inside BuildFormalParameterSection. The shadow
variable needs to have the other definition or implementation module
token position set when CheckFormalParameterSection is called.
This allows the MetaError family of procedures to request the
implementation module token position when reporting unused parameters.
gcc/m2/ChangeLog:
PR modula2/110003
* gm2-compiler/P2SymBuild.mod (GetParameterShadowVar): Import.
(CheckFormalParameterSection): Call PutDeclared for the shadow
variable associated with the parameter.
(cherry picked from commit 7c0e2159afb3235950d3d8f61ef085cd1ccf0dfc)
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-07-29 12:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27 15:03 [Bug modula2/110003] New: Wrong source line listed for unused parameters admin@tho-otto.de
2023-06-03 12:53 ` [Bug modula2/110003] " gaius at gcc dot gnu.org
2023-06-03 14:18 ` gaius at gcc dot gnu.org
2023-06-03 14:28 ` cvs-commit at gcc dot gnu.org
2023-06-03 14:29 ` gaius at gcc dot gnu.org
2023-07-29 12:48 ` cvs-commit at gcc dot gnu.org
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).