https://gcc.gnu.org/g:97ad987fc19e96e97cb0bdb55d0bf41014f77de9
commit r16-6627-g97ad987fc19e96e97cb0bdb55d0bf41014f77de9 Author: Viljar Indus <[email protected]> Date: Wed Dec 3 11:49:45 2025 +0200 ada: Update -gnatwk error messages with Diagnostic_Id-s 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. Diff: --- 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 b81911211361..7b95400d0e42 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 73e23588882f..59e926294f82 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 312dd013a47f..eb67414e62c0 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 d121e6985862..9c7c59e8643a 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);
