[Ada] Implement AI12-0343 Return Statement Checks
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 1 Apr 2020 17:13:06 +0000 (19:13 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 15 Jun 2020 08:04:39 +0000 (04:04 -0400)
commitc5a913d3fd22769d66d480c2487edcf1d50644c5
treebe42a128e9648a12f83adbde5f32b168ab889b1c
parentacc20d256c51f394904b904e8a8ceea3a44855fc
[Ada] Implement AI12-0343 Return Statement Checks

2020-06-15  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* einfo.ads (Return_Applies_To): Document special usage for E_Block.
* einfo.adb (Write_Field8_Name): Write it for E_Block too.
* exp_ch4.adb (Expand_N_Type_Conversion): Remove implementation of
the check prescribed by AI05-0073.
* exp_ch6.adb (Apply_CW_Accessibility_Check): New procedure to apply
the check prescribed by AI95-344 extracted from...
(Expand_N_Extended_Return_Statement): Apply the check prescribed by
AI95-344 to the expression, if present.  Suppress only access checks
when analyzing the rewritten result.
(Expand_Simple_Function_Return): ...here.  Rename local variable.
Call Apply_CW_Accessibility_Check to apply the check prescribed by
AI95-344, but do not do it for the simple return statement generated
by the expansion of an extended return statement.  Apply the check
prescribed by AI05-0073 to all functions returning anonymous access
type designating a specific tagged type, but not if the expression
was null or tag checks are suppressed for the type, and use Not In
operator rather than comparing the tags explicitly.
* sem.adb (Analyze): Handle all Suppress values.
* sem_ch6.adb (Analyze_Function_Return): Do not explicitly apply
predicate checks in the case of an extended return statement.
Do not apply an implicit conversion to the anonymous access result
type in the case of the simple return statement generated by the
expansion of an extended return statement.
(New_Overloaded_Entity): Small comment tweak.
* treepr.adb (Print_Node): Fix typo in flag string.
gcc/ada/einfo.adb
gcc/ada/einfo.ads
gcc/ada/exp_ch4.adb
gcc/ada/exp_ch6.adb
gcc/ada/sem.adb
gcc/ada/sem_ch6.adb
gcc/ada/treepr.adb