From: Eric Botcazou Date: Fri, 20 May 2022 17:06:28 +0000 (+0200) Subject: [Ada] Never make symbols for thunks public X-Git-Tag: basepoints/gcc-14~6254 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da7cd04339b4db1bfdc4846eca2df04deca1a9b2;p=thirdparty%2Fgcc.git [Ada] Never make symbols for thunks public Thunks are only referenced locally by dispatch tables and never inlined. gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Clear the Is_Public flag on thunks. --- diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 8fd88ade84e..848c2349200 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -4772,6 +4772,13 @@ package body Sem_Ch6 is if Nkind (N) /= N_Subprogram_Body or else not Was_Expression_Function (N) then + -- First clear the Is_Public flag on thunks since they are only + -- referenced locally by dispatch tables and thus never inlined. + + if Is_Thunk (Body_Id) then + Set_Is_Public (Body_Id, False); + end if; + Freeze_Before (N, Body_Id); end if;