aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gen_il-gen-gen_nodes.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2021-05-08 11:39:52 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-07-06 14:46:54 +0000
commit82a794419a00ea98b68d69b64363ae6746710de9 (patch)
treea216a476635457a50b68eac80396d690071b19a4 /gcc/ada/gen_il-gen-gen_nodes.adb
parent06a5fb60eb53ef297454f58db61d3374d538f515 (diff)
downloadgcc-82a794419a00ea98b68d69b64363ae6746710de9.zip
gcc-82a794419a00ea98b68d69b64363ae6746710de9.tar.gz
gcc-82a794419a00ea98b68d69b64363ae6746710de9.tar.bz2
[Ada] Tbuild cleanup
gcc/ada/ * tbuild.adb (Convert_To): Add assert, along with a comment. (Make_DT_Access): Remove this function, which is not used. It was incorrect anyway (the call to New_Occurrence_Of should not be there). (Unchecked_Convert_To): Add assert. The previous version's test for unchecked conversion to the same type was redundant and could never be true, because the previous 'if' already checked for ANY expression of the same type. Remove that, and replace with a test for unchecked conversion to a related type. Otherwise, we somethings get things like "finalize(some_type!(some_type!(x)))" in the generated code, where x is already of type some_type, but we're converting it to the private type and then to the full type or vice versa (so the types aren't equal, so the previous 'if' doesn't catch it). Avoid updating the Parent. This is not necessary; the Parent will be updated if/when the node is attached to the tree. * tbuild.ads: Fix comments. No need to say "this is safe" when we just explained that a few lines earlier. Remove Make_DT_Access. * sinfo.ads: Add comments. * exp_ch7.adb (Make_Finalize_Address_Stmts): Minor comment fix. * gen_il-gen.adb, gen_il-gen.ads, gen_il-gen-gen_nodes.adb, gen_il-internals.ads: Implement a feature where you can put: Nmake_Assert => "expr" where expr is a boolean expression in a call to Create_Concrete_Node_Type. It is added in a pragma Assert in the Nmake.Make_... function for that type.
Diffstat (limited to 'gcc/ada/gen_il-gen-gen_nodes.adb')
-rw-r--r--gcc/ada/gen_il-gen-gen_nodes.adb10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb
index ef7dfa4..2427a1e 100644
--- a/gcc/ada/gen_il-gen-gen_nodes.adb
+++ b/gcc/ada/gen_il-gen-gen_nodes.adb
@@ -31,7 +31,8 @@ procedure Gen_IL.Gen.Gen_Nodes is
renames Create_Abstract_Node_Type;
procedure Cc -- Short for "ConCrete"
(T : Concrete_Node; Parent : Abstract_Type;
- Fields : Field_Sequence := No_Fields)
+ Fields : Field_Sequence := No_Fields;
+ Nmake_Assert : String := "")
renames Create_Concrete_Node_Type;
function Sy -- Short for "Syntactic"
@@ -562,7 +563,12 @@ begin -- Gen_IL.Gen.Gen_Nodes
(Sy (Subtype_Mark, Node_Id, Default_Empty),
Sy (Expression, Node_Id, Default_Empty),
Sm (Kill_Range_Check, Flag),
- Sm (No_Truncation, Flag)));
+ Sm (No_Truncation, Flag)),
+ Nmake_Assert => "True or else Nkind (Expression) /= N_Unchecked_Type_Conversion");
+-- Nmake_Assert => "Nkind (Expression) /= N_Unchecked_Type_Conversion");
+ -- Assert that we don't have unchecked conversions of unchecked
+ -- conversions; if Expression might be an unchecked conversion,
+ -- then Tbuild.Unchecked_Convert_To should be used.
Cc (N_Subtype_Indication, N_Has_Etype,
(Sy (Subtype_Mark, Node_Id, Default_Empty),