From 54c49fcdd7064b20b557f1027ae03c9eac2b07d4 Mon Sep 17 00:00:00 2001 From: Ghjuvan Lacambre Date: Thu, 23 Jul 2020 09:51:43 +0200 Subject: [PATCH] [Ada] Disable warnings on entities when building finalizers gcc/ada/ * exp_ch7.adb (Build_Finalizer): Disable warnings on referenced entity. --- gcc/ada/exp_ch7.adb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 1264eebeb85..b58a3c1d224 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -3157,6 +3157,14 @@ package body Exp_Ch7 is Append_To (Finalizer_Stmts, Label); + -- Disable warnings on Obj_Id. This works around an issue where GCC + -- is not able to detect that Obj_Id is protected by a counter and + -- emits spurious warnings. + + if not Comes_From_Source (Obj_Id) then + Set_Warnings_Off (Obj_Id); + end if; + -- Processing for simple protected objects. Such objects require -- manual finalization of their lock managers. -- 2.30.2