Commit 622599c6 by Robert Dewar Committed by Arnaud Charlet

a-assert.adb: Minor reformatting.

2015-01-30  Robert Dewar  <dewar@adacore.com>

	* a-assert.adb: Minor reformatting.
	* sem_ch13.adb: Minor comment clarification.
	* types.ads: Minor comment update.
	* sem_eval.adb (Real_Or_String_Static_Predicate_Matches): Avoid blow up
	when we have a predicate that is nothing but an inherited dynamic
	predicate.

From-SVN: r220290
parent 0d1476cb
2015-01-30 Robert Dewar <dewar@adacore.com>
* a-assert.adb: Minor reformatting.
* sem_ch13.adb: Minor comment clarification.
* types.ads: Minor comment update.
* sem_eval.adb (Real_Or_String_Static_Predicate_Matches): Avoid blow up
when we have a predicate that is nothing but an inherited dynamic
predicate.
2015-01-30 Jerome Guitton <guitton@adacore.com> 2015-01-30 Jerome Guitton <guitton@adacore.com>
* gcc-interface/Makefile.in (x86-vxworks): Update GCC_SPEC_FILES to * gcc-interface/Makefile.in (x86-vxworks): Update GCC_SPEC_FILES to
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
package body Ada.Assertions with package body Ada.Assertions with
SPARK_Mode SPARK_Mode
is is
------------ ------------
-- Assert -- -- Assert --
------------ ------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -11281,9 +11281,12 @@ package body Sem_Ch13 is ...@@ -11281,9 +11281,12 @@ package body Sem_Ch13 is
-- expression and then xxPredicate (typ (Inns)) -- expression and then xxPredicate (typ (Inns))
-- Where the call is to a Predicate function for an inherited predicate. -- Where the call is to a Predicate function for an inherited predicate.
-- We simply ignore such a call (which could be to either a dynamic or -- We simply ignore such a call, which could be to either a dynamic or
-- a static predicate, but remember that we can have a Static_Predicate -- a static predicate. Note that if the parent predicate is dynamic then
-- for a non-static subtype). -- eventually this type will be marked as dynamic, but you are allowed
-- to specify a static predicate for a subtype which is inheriting a
-- dynamic predicate, so the static predicate validation here ignores
-- the inherited predicate even if it is dynamic.
elsif Nkind (Expr) = N_Function_Call elsif Nkind (Expr) = N_Function_Call
and then Is_Predicate_Function (Entity (Name (Expr))) and then Is_Predicate_Function (Entity (Name (Expr)))
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -5432,18 +5432,29 @@ package body Sem_Eval is ...@@ -5432,18 +5432,29 @@ package body Sem_Eval is
Copy := Copy_Separate_Tree (Left_Opnd (Expr)); Copy := Copy_Separate_Tree (Left_Opnd (Expr));
-- Case where call to predicate function appears on its own -- Case where call to predicate function appears on its own (this means
-- that the predicate at this level is just inherited from the parent).
elsif Nkind (Expr) = N_Function_Call then elsif Nkind (Expr) = N_Function_Call then
declare
Typ : constant Entity_Id :=
Etype (First_Formal (Entity (Name (Expr))));
-- Here the result is just the result of calling the inner predicate begin
-- If the inherited predicate is dynamic, just ignore it. We can't
-- go trying to evaluate a dynamic predicate as a static one!
return if Has_Dynamic_Predicate_Aspect (Typ) then
Real_Or_String_Static_Predicate_Matches return True;
(Val => Val,
Typ => Etype (First_Formal (Entity (Name (Expr))))); -- Otherwise inherited predicate is static, check for match
else
return Real_Or_String_Static_Predicate_Matches (Val, Typ);
end if;
end;
-- If no inherited predicate, copy whole expression -- If not just an inherited predicate, copy whole expression
else else
Copy := Copy_Separate_Tree (Expr); Copy := Copy_Separate_Tree (Expr);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -107,7 +107,7 @@ package Types is ...@@ -107,7 +107,7 @@ package Types is
subtype Upper_Half_Character is subtype Upper_Half_Character is
Character range Character'Val (16#80#) .. Character'Val (16#FF#); Character range Character'Val (16#80#) .. Character'Val (16#FF#);
-- Characters with the upper bit set -- 8-bit Characters with the upper bit set
type Character_Ptr is access all Character; type Character_Ptr is access all Character;
type String_Ptr is access all String; type String_Ptr is access all String;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment