From: Viljar Indus <[email protected]>
Add new entries to the Diagnostic_Id-s and entries to the diagnostic
repository for error messages that are activated by -gnatwk.
gcc/ada/ChangeLog:
* errid-diagnostic_repository.ads: Update the diagnostic repository.
* errid-switch_repository.ads: Update the switch repository.
* errid.ads: Add new Diagnostic_Id-s.
* sem_warn.adb (Check_References): Add Diagnostic_Id-s for
error messages triggered by -gnatwk.
Tested on x86_64-pc-linux-gnu (before the recent bootstrap breakage), committed
on master.
---
gcc/ada/errid-diagnostic_repository.ads | 14 +++++++++++++-
gcc/ada/errid-switch_repository.ads | 3 ++-
gcc/ada/errid.ads | 5 ++++-
gcc/ada/sem_warn.adb | 12 +++++++++---
4 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/gcc/ada/errid-diagnostic_repository.ads
b/gcc/ada/errid-diagnostic_repository.ads
index b8191121136..7b95400d0e4 100644
--- a/gcc/ada/errid-diagnostic_repository.ads
+++ b/gcc/ada/errid-diagnostic_repository.ads
@@ -82,5 +82,17 @@ package Errid.Diagnostic_Repository is
GNAT0006 =>
(Status => Active,
Human_Id => new String'("Mixed_Container_Aggregate_Error"),
- Switch => No_Switch_Id));
+ Switch => No_Switch_Id),
+ GNAT0007 =>
+ (Status => Active,
+ Human_Id => new String'("Volatile_Not_Modifed_Warning"),
+ Switch => gnatwk),
+ GNAT0008 =>
+ (Status => Active,
+ Human_Id => new String'("Variable_Not_Modifed_Warning"),
+ Switch => gnatwk),
+ GNAT0009 =>
+ (Status => Active,
+ Human_Id => new String'("In_Out_Not_Modifed_Warning"),
+ Switch => gnatwk));
end Errid.Diagnostic_Repository;
diff --git a/gcc/ada/errid-switch_repository.ads
b/gcc/ada/errid-switch_repository.ads
index 73e23588882..59e926294f8 100644
--- a/gcc/ada/errid-switch_repository.ads
+++ b/gcc/ada/errid-switch_repository.ads
@@ -120,7 +120,8 @@ package Errid.Switch_Repository is
Short_Name => new String'("gnatwk"),
Description => null,
Documentation_Url => null,
- Diagnostics => null),
+ Diagnostics =>
+ new Diagnostic_Id_Array'(GNAT0007, GNAT0008, GNAT0009)),
gnatwl =>
(Human_Id => new String'("Elab_Warnings"),
Status => Active,
diff --git a/gcc/ada/errid.ads b/gcc/ada/errid.ads
index 312dd013a47..eb67414e62c 100644
--- a/gcc/ada/errid.ads
+++ b/gcc/ada/errid.ads
@@ -36,7 +36,10 @@ package Errid is
GNAT0003,
GNAT0004,
GNAT0005,
- GNAT0006);
+ GNAT0006,
+ GNAT0007,
+ GNAT0008,
+ GNAT0009);
type Diagnostic_Id_Array is array (Positive range <>) of Diagnostic_Id;
type Diagnostic_Id_Array_Access is access Diagnostic_Id_Array;
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index d121e698586..9c7c59e8643 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -28,6 +28,7 @@ with Atree; use Atree;
with Debug; use Debug;
with Einfo.Entities; use Einfo.Entities;
with Einfo.Utils; use Einfo.Utils;
+with Errid; use Errid;
with Errout; use Errout;
with Exp_Code; use Exp_Code;
with Lib; use Lib;
@@ -1310,7 +1311,9 @@ package body Sem_Warn is
then
Error_Msg_N
("?k?& is not modified, consider pragma Export for "
- & "volatile variable!", E1);
+ & "volatile variable!",
+ E1,
+ GNAT0007);
-- Another special case, Exception_Occurrence, this catches
-- the case of exception choice (and a bit more too, but not
@@ -1330,7 +1333,8 @@ package body Sem_Warn is
then
Error_Msg_N -- CODEFIX
("?k?& is not modified, could be declared constant!",
- E1);
+ E1,
+ GNAT0008);
end if;
-- Other cases of a variable or parameter never set in source
@@ -3102,7 +3106,9 @@ package body Sem_Warn is
if not Is_Trivial_Subprogram (Scope (E1)) then
if Warn_On_Constant then
Error_Msg_N
- ("?k?formal parameter & is not modified!", E1);
+ ("?k?formal parameter & is not modified!",
+ E1,
+ GNAT0009);
Error_Msg_N
("\?k?mode could be IN instead of `IN OUT`!", E1);
--
2.51.0