From: Javier Miranda <[email protected]>
Reverse the meaning of switch -gnatd_P; that is, enable by default
the generating of a runtime check when the prefix of the call is
an access-to-subprogram type with a null value.
gcc/ada/ChangeLog:
* sem_res.adb (Resolve_Actuals): Add by default a null-exclusion
check on the prefix of the call when it is an access-type; it can
be disabled using -gnatd_P.
* debug.adb (gnatd_P): Update documentation.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/debug.adb | 17 +++++++++--------
gcc/ada/sem_res.adb | 2 +-
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb
index 9daa0110233..2d0c32b0f09 100644
--- a/gcc/ada/debug.adb
+++ b/gcc/ada/debug.adb
@@ -180,7 +180,7 @@ package body Debug is
-- d_M Ignore Source_File_Name and Source_File_Name_Project pragmas
-- d_N
-- d_O
- -- d_P Enable runtime check for null prefix of prefixed subprogram call
+ -- d_P Disable runtime check for null prefix of prefixed subprogram call
-- d_Q
-- d_R For LLVM, dump the representation of records
-- d_S
@@ -1040,13 +1040,14 @@ package body Debug is
-- it is checked, and the progress of the recursive trace through
-- elaboration calls at compile time.
- -- d_P For prefixed subprogram calls with an access-type prefix, generate
- -- a null-excluding runtime check on the prefix, even when the called
- -- subprogram has a first access parameter that does not exclude null
- -- (that is the case only for class-wide parameter, as controlling
- -- parameters are automatically null-excluding). In such a case,
- -- P.Proc is equivalent to Proc(P.all'Access); see RM 6.4(9.1/5).
- -- This includes a dereference, and thus a null check.
+ -- d_P For prefixed subprogram calls with an access-type prefix, disable
+ -- the generation of a null-excluding runtime check on the prefix,
+ -- even when the called subprogram has a first access parameter that
+ -- does not exclude null (that is the case only for class-wide
+ -- parameter, as controlling parameters are automatically null-
+ -- excluding). In such a case, P.Proc is equivalent to the call
+ -- Proc(P.all'Access); see RM 6.4(9.1/5). This includes a dereference,
+ -- and thus a null check.
-- d_R In the LLVM backend, output the internal representation of
-- each record
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index d2b019aef17..2d0e2be1849 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -4942,7 +4942,7 @@ package body Sem_Res is
A, Nam);
end if;
- if Debug_Flag_Underscore_PP
+ if not Debug_Flag_Underscore_PP
and then
(Is_Controlling_Formal (F)
or else Is_Class_Wide_Type (Designated_Type (F_Typ)))
--
2.43.0