diff options
author | Justin Squirek <squirek@adacore.com> | 2019-08-13 08:06:50 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-13 08:06:50 +0000 |
commit | 943c82d7b9bc15161ac344953b2deb0a4121b279 (patch) | |
tree | f7ff9f56183bae7ac7082c37f833291f644f1faa /gcc/ada | |
parent | 114042b8861a33ec7227c5ac2967058ee60c248f (diff) | |
download | gcc-943c82d7b9bc15161ac344953b2deb0a4121b279.zip gcc-943c82d7b9bc15161ac344953b2deb0a4121b279.tar.gz gcc-943c82d7b9bc15161ac344953b2deb0a4121b279.tar.bz2 |
[Ada] Disable anonymous allocator warning for library-level objects
This patch modifies the behavior of anonymous allocator warnings so that
they no longer get triggered in the case of an object declaration at
library-level.
2019-08-13 Justin Squirek <squirek@adacore.com>
gcc/ada/
* exp_ch4.adb (Expand_N_Allocator): Add condition to detect
library-level object declarations
gcc/testsuite/
* gnat.dg/anon3.adb, gnat.dg/anon3.ads: New testcase.
From-SVN: r274338
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/exp_ch4.adb | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f4ad36d..5a9a9cc 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-08-13 Justin Squirek <squirek@adacore.com> + + * exp_ch4.adb (Expand_N_Allocator): Add condition to detect + library-level object declarations + 2019-08-13 Eric Botcazou <ebotcazou@adacore.com> * doc/gnat_ugn/building_executable_programs_with_gnat.rst diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 6f2fe32..4404c5d 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -4421,10 +4421,13 @@ package body Exp_Ch4 is begin -- Warn on the presence of an allocator of an anonymous access type when - -- enabled. + -- enabled except when its an object declaration at library level. if Warn_On_Anonymous_Allocators and then Ekind (PtrT) = E_Anonymous_Access_Type + and then not (Is_Library_Level_Entity (PtrT) + and then Nkind (Associated_Node_For_Itype (PtrT)) = + N_Object_Declaration) then Error_Msg_N ("?use of an anonymous access type allocator", N); end if; |