summaryrefslogtreecommitdiff
path: root/gcc/ada/checks.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-04 12:14:25 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-04 12:14:25 +0000
commitd16989f1452cb804265d6d5a49d66c84d7083f75 (patch)
treea52c5e1da5d0dd6afa9050656b9edb462a9793c4 /gcc/ada/checks.adb
parent2ca588c5c8aa3940fb5596ce3bd4d51d916cb510 (diff)
downloadgcc-d16989f1452cb804265d6d5a49d66c84d7083f75.tar.gz
2008-08-04 Javier Miranda <miranda@adacore.com>
* sem_ch3.adb (Access_Subprogram_Declaration): Adding missing support for N_Formal_Object_Declaration nodes. Adding kludge required by First_Formal to provide its functionality with access to functions. (Replace_Anonymous_Access_To_Protected_Subprogram): Add missing support for anonymous access types returned by functions. * sem_ch5.adb (Analyze_Assignment): Code cleanup to avoid duplicate conversion of null-excluding access types (required only once to force the generation of the required runtime check). * sem_type.adb (Covers): minor reformating * checks.adb (Null_Exclusion_Static_Checks): Avoid reporting errors with internally generated nodes. Avoid generating the error inside init procs. * sem_res.adb (Resolve_Membership_Test): Minor reformating. (Resolve_Null): Generate the null-excluding check in case of assignment to a null-excluding object. (Valid_Conversion): Add missing support for anonymous access to subprograms. * sem_ch6.adb (Check_Return_Subtype_Indication): Add missing support for anonymous access types whose designated type is an itype. This case occurs with anonymous access to protected subprograms types. (Analyze_Return_Type): Add missing support for anonymous access to protected subprogram. * sem_eval.adb (Subtypes_Statically_Match): In case of access to subprograms addition of missing check on matching convention. Required to properly handle access to protected subprogram types. * exp_ch3 (Build_Assignment): Code cleanup removing duplicated check on null excluding access types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138610 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/checks.adb')
-rw-r--r--gcc/ada/checks.adb24
1 files changed, 15 insertions, 9 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index f55bd7cec75..38b1a07e409 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -2871,11 +2871,7 @@ package body Checks is
-- be applied to a [sub]type that does not exclude null already.
elsif Can_Never_Be_Null (Typ)
-
- -- No need to check itypes that have a null exclusion because
- -- they are already examined at their point of creation.
-
- and then not Is_Itype (Typ)
+ and then Comes_From_Source (Typ)
then
Error_Msg_NE
("`NOT NULL` not allowed (& already excludes null)",
@@ -5306,10 +5302,20 @@ package body Checks is
-- If known to be null, here is where we generate a compile time check
if Known_Null (N) then
- Apply_Compile_Time_Constraint_Error
- (N,
- "null value not allowed here?",
- CE_Access_Check_Failed);
+
+ -- Avoid generating warning message inside init procs
+
+ if not Inside_Init_Proc then
+ Apply_Compile_Time_Constraint_Error
+ (N,
+ "null value not allowed here?",
+ CE_Access_Check_Failed);
+ else
+ Insert_Action (N,
+ Make_Raise_Constraint_Error (Loc,
+ Reason => CE_Access_Check_Failed));
+ end if;
+
Mark_Non_Null;
return;
end if;