From 8c5689b93e68ac34cdf7dd089a3990ae22f0049c Mon Sep 17 00:00:00 2001
From: Xiretza <xiretza@xiretza.xyz>
Date: Sat, 14 May 2022 11:46:53 +0200
Subject: [PATCH] fix: avoid "pragma Unreferenced given" warnings with GCC 12

---
 src/ghdldrv/ghdldrv.adb            | 2 +-
 src/synth/synth-vhdl_stmts.adb     | 2 +-
 src/vhdl/translate/trans-chap2.adb | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb
index e7990ed4d4..0313e60579 100644
--- a/src/ghdldrv/ghdldrv.adb
+++ b/src/ghdldrv/ghdldrv.adb
@@ -1192,7 +1192,6 @@ package body Ghdldrv is
    procedure Perform_Action (Cmd : in out Command_Elab; Args : Argument_List)
    is
       Success : Boolean;
-      pragma Unreferenced (Success);
    begin
       Set_Elab_Units (Cmd, "-e", Args);
       Setup_Compiler (Cmd, False);
@@ -1202,6 +1201,7 @@ package body Ghdldrv is
          Link (Cmd, Add_Std => True, Disp_Only => False);
       end if;
       Delete_File (Filelist_Name.all, Success);
+      pragma Unreferenced (Success);
    end Perform_Action;
 
    --  Command Run.
diff --git a/src/synth/synth-vhdl_stmts.adb b/src/synth/synth-vhdl_stmts.adb
index 3e09c3318e..6fa2e92272 100644
--- a/src/synth/synth-vhdl_stmts.adb
+++ b/src/synth/synth-vhdl_stmts.adb
@@ -1933,11 +1933,11 @@ package body Synth.Vhdl_Stmts is
                                            Assoc_Chain : Node)
    is
       Infos : Target_Info_Array (1 .. 0);
-      pragma Unreferenced (Infos);
       Init : Association_Iterator_Init;
    begin
       Init := Association_Iterator_Build (Inter_Chain, Assoc_Chain);
       Synth_Subprogram_Association (Subprg_Inst, Caller_Inst, Init, Infos);
+      pragma Unreferenced (Infos);
    end Synth_Subprogram_Association;
 
    --  Create wires for out and inout interface variables.
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb
index ff04a13b78..9e7e329157 100644
--- a/src/vhdl/translate/trans-chap2.adb
+++ b/src/vhdl/translate/trans-chap2.adb
@@ -1006,7 +1006,6 @@ package body Trans.Chap2 is
       Info   : constant Ortho_Info_Acc := Get_Info (Spec);
       Final  : Boolean;
       Constr : O_Assoc_List;
-      pragma Unreferenced (Final);
    begin
       if not Is_Nested then
          Start_Subprogram_Body (Info.Package_Elab_Spec_Subprg);
@@ -1039,6 +1038,7 @@ package body Trans.Chap2 is
             (Info.Package_Spec_Scope'Access, Info.Package_Spec_Scope));
       end if;
       Chap4.Elab_Declaration_Chain (Spec, Final);
+      pragma Unreferenced (Final);
 
       if not Is_Nested then
          Close_Temp;
