diff options
author | Ronan Desplanques <desplanques@adacore.com> | 2023-08-21 13:35:37 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-09-05 13:05:15 +0200 |
commit | 9be6a698f95f94a27307208cdb90bd2018182071 (patch) | |
tree | e2d77e4c7d04b99f50b28636e473c47df4c9b6e0 /gcc/c | |
parent | 2f1cde4d511b9da6081b785f1c50b7e7aa271b4f (diff) | |
download | gcc-9be6a698f95f94a27307208cdb90bd2018182071.zip gcc-9be6a698f95f94a27307208cdb90bd2018182071.tar.gz gcc-9be6a698f95f94a27307208cdb90bd2018182071.tar.bz2 |
ada: Fix spurious warning emissions
Before this patch, warnings handled by `Sem_Warn.Check_References` were
erroneously emitted in some cases. Here is an example of a program that,
when compiled with the `-gnatwu` switch, triggered the bug:
procedure Main is
package T is
A : Integer;
end T;
begin
T.A := 7;
end Main;
The following message was emitted:
main.adb:3:07: warning: variable "A" is never read and never assigned [-gnatwu]
This patch mitigates the issue by restricting the cases in which
`Sem_Warn.Check_References` is called for package specifications.
Note that the recursive calls in `Sem_Warn.Check_References` can be used
to convince oneself that this patch does not remove legitimate warnings
for non-library-level package specifications.
gcc/ada/
* sem_ch7.adb (Analyze_Package_Declaration): Restrict calls to
`Sem_Warn.Check_References` and adjust comment accordingly.
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions