aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils2.cc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-06-28 19:03:00 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2022-07-13 10:01:22 +0000
commit1f3f64b9e777a706662554ef39a512544244ef0c (patch)
tree55685db14669e4cb9ed2988d75cfa55782ab0a2b /gcc/ada/gcc-interface/utils2.cc
parent351659f8dc80f1faaefae9fec2eab30c24ff282d (diff)
downloadgcc-1f3f64b9e777a706662554ef39a512544244ef0c.zip
gcc-1f3f64b9e777a706662554ef39a512544244ef0c.tar.gz
gcc-1f3f64b9e777a706662554ef39a512544244ef0c.tar.bz2
[Ada] Extend No_Dependence restriction to code generation
This reports violations for 4 units from gigi. gcc/ada/ * gcc-interface/trans.cc (gigi): Report a violation of No_Dependence on System.Stack_Checking if Stack_Check_Probes_On_Target is not set and -fstack-check is specified. (build_binary_op_trapv): Report violatiosn of No_Dependence on both System.Arith_64 and System.Arith_128. (add_decl_expr): If an initialized variable, report a violation of No_Dependence on System.Memory_Copy for large aggregate types. (gnat_to_gnu) <N_Op_Eq>: Report a violation of No_Dependence on System.Memory_Compare for large aggregate types. <N_Assignment_Statement>! Report a violation of No_Dependence on System.Memory_Set, System.Memory_Move or else System.Memory_Copy for large aggregate types. * gcc-interface/utils2.cc (maybe_wrap_malloc): Report a violation of No_Dependence on System.Memory. (maybe_wrap_free): Add GNAT_NODE parameter and report a violation of No_Dependence on System.Memory. (build_call_alloc_dealloc): Adjust call to maybe_wrap_free.
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.cc')
-rw-r--r--gcc/ada/gcc-interface/utils2.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc
index 4dfe29d..4c66a93 100644
--- a/gcc/ada/gcc-interface/utils2.cc
+++ b/gcc/ada/gcc-interface/utils2.cc
@@ -2259,6 +2259,8 @@ maybe_wrap_malloc (tree data_size, tree data_type, Node_Id gnat_node)
tree malloc_ptr = build_call_n_expr (malloc_decl, 1, size_to_malloc);
+ Check_Restriction_No_Dependence_On_System (Name_Memory, gnat_node);
+
if (aligning_type)
{
/* Latch malloc's return value and get a pointer to the aligning field
@@ -2305,7 +2307,7 @@ maybe_wrap_malloc (tree data_size, tree data_type, Node_Id gnat_node)
designated by DATA_PTR using the __gnat_free entry point. */
static inline tree
-maybe_wrap_free (tree data_ptr, tree data_type)
+maybe_wrap_free (tree data_ptr, tree data_type, Node_Id gnat_node)
{
/* In the regular alignment case, we pass the data pointer straight to free.
In the superaligned case, we need to retrieve the initial allocator
@@ -2317,6 +2319,8 @@ maybe_wrap_free (tree data_ptr, tree data_type)
tree free_ptr;
+ Check_Restriction_No_Dependence_On_System (Name_Memory, gnat_node);
+
if (data_align > system_allocator_alignment)
{
/* DATA_FRONT_PTR (void *)
@@ -2363,7 +2367,7 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, tree gnu_type,
/* Otherwise, object to "free" or "malloc" with possible special processing
for alignments stricter than what the default allocator honors. */
else if (gnu_obj)
- return maybe_wrap_free (gnu_obj, gnu_type);
+ return maybe_wrap_free (gnu_obj, gnu_type, gnat_node);
else
{
/* Assert that we no longer can be called with this special pool. */