* sem_ch5.adb (Analyze_Iteration_Scheme): Diagnose attempt to use thew
form "for X in A" when A is an array object. This form is only intended
for containers.
* sem_eval.adb: Fix reference to non-existing field of type conversion
node.
* sem_case.adb (Check_Choices): Improve error reporting for overlapping
choices in case statements.
2010-10-26 Gary Dismukes <dismukes@adacore.com>
* exp_disp.adb (Expand_Interface_Actuals): When expanding an actual for
a class-wide interface formal that involves applying a displacement
conversion to the actual, check for the case of calling a build-in-place
function and handle generation of the implicit BIP parameters (call
Make_Build_In_Place_Call_In_Anonymous_Context).
Add with and use of Exp_Ch6.
2010-10-26 Robert Dewar <dewar@adacore.com>
* sem_prag.adb, sem_cat.ads: Minor reformatting.
2010-10-26 Sergey Rybin <rybin@adacore.com>
* vms_data.ads: Define VMS qualifier for gnatelim '--ignore' option
2010-10-26 Thomas Quinot <quinot@adacore.com>
* sem_util.adb (Has_Preelaborable_Initialization.Check_Components):
For a discriminant, use Discriminant_Default_Value rather than
Expression (Declaration_Node (D)).
2010-10-26 Geert Bosch <bosch@adacore.com>
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Parameterized
expressions don't need a spec, even when style checks require
subprograms to have one.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165941
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-10-26 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch5.adb (Analyze_Iteration_Scheme): Diagnose attempt to use thew
+ form "for X in A" when A is an array object. This form is only intended
+ for containers.
+ * sem_eval.adb: Fix reference to non-existing field of type conversion
+ node.
+ * sem_case.adb (Check_Choices): Improve error reporting for overlapping
+ choices in case statements.
+
+2010-10-26 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_disp.adb (Expand_Interface_Actuals): When expanding an actual for
+ a class-wide interface formal that involves applying a displacement
+ conversion to the actual, check for the case of calling a build-in-place
+ function and handle generation of the implicit BIP parameters (call
+ Make_Build_In_Place_Call_In_Anonymous_Context).
+ Add with and use of Exp_Ch6.
+
+2010-10-26 Robert Dewar <dewar@adacore.com>
+
+ * sem_prag.adb, sem_cat.ads: Minor reformatting.
+
+2010-10-26 Sergey Rybin <rybin@adacore.com>
+
+ * vms_data.ads: Define VMS qualifier for gnatelim '--ignore' option
+
+2010-10-26 Thomas Quinot <quinot@adacore.com>
+
+ * sem_util.adb (Has_Preelaborable_Initialization.Check_Components):
+ For a discriminant, use Discriminant_Default_Value rather than
+ Expression (Declaration_Node (D)).
+
+2010-10-26 Geert Bosch <bosch@adacore.com>
+
+ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Parameterized
+ expressions don't need a spec, even when style checks require
+ subprograms to have one.
+
2010-10-26 Arnaud Charlet <charlet@adacore.com>
* gnatvsn.ads: Update comments.
with Elists; use Elists;
with Errout; use Errout;
with Exp_Atag; use Exp_Atag;
+with Exp_Ch6; use Exp_Ch6;
with Exp_Ch7; use Exp_Ch7;
with Exp_CG; use Exp_CG;
with Exp_Dbug; use Exp_Dbug;
-- the displacement of the pointer.
else
+ -- Normally, expansion of actuals for calls to build-in-place
+ -- functions happens as part of Expand_Actuals, but in this
+ -- case the call will be wrapped in a conversion and soon after
+ -- expanded further to handle the displacement for a class-wide
+ -- interface conversion, so if this is a BIP call then we need
+ -- to handle it now.
+
+ if Ada_Version >= Ada_2005
+ and then Is_Build_In_Place_Function_Call (Actual)
+ then
+ Make_Build_In_Place_Call_In_Anonymous_Context (Actual);
+ end if;
+
Conversion := Convert_To (Formal_Typ, Relocate_Node (Actual));
Rewrite (Actual, Conversion);
Analyze_And_Resolve (Actual, Formal_Typ);
Hi := Expr_Value (Choice_Table (J).Hi);
if Lo <= Prev_Hi then
- Prev_Choice := Choice_Table (J - 1).Node;
Choice := Choice_Table (J).Node;
+ -- Find first previous choice that overlaps.
+
+ for K in 1 .. J - 1 loop
+ if Lo <= Expr_Value (Choice_Table (K).Hi) then
+ Prev_Choice := Choice_Table (K).Node;
+ exit;
+ end if;
+ end loop;
+
if Sloc (Prev_Choice) <= Sloc (Choice) then
Error_Msg_Sloc := Sloc (Prev_Choice);
Error_Msg_N ("duplication of choice value#", Choice);
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- --
-- 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- --
-- T is the entity of the declared type.
procedure Validate_Static_Object_Name (N : Node_Id);
- -- In the elaboration code of a preelaborated library unit, check
- -- that we do not have the evaluation of a primary that is a name of
- -- an object, unless the name is a static expression (RM 10.2.1(8)).
- -- Non-static constant and variable are the targets, generic parameters
+ -- In the elaboration code of a preelaborated library unit, check that we
+ -- do not have the evaluation of a primary that is a name of an object,
+ -- unless the name is a static expression (RM 10.2.1(8)). Non-static
+ -- constant and variable are the targets, generic parameters are not
-- are not included because the generic declaration and body are
-- preelaborable.
-- Start of processing for Analyze_Iteration_Scheme
begin
- -- Why is following check needed ???
+ -- If this is a rewritten quantified expression, the iteration
+ -- scheme has been analyzed already. Do no repeat analysis because
+ -- the loop variable is already declared.
if Analyzed (N) then
return;
if Of_Present (N) then
Set_Etype (Def_Id, Component_Type (Typ));
else
+ Error_Msg_N
+ ("to iterate over the elements of an array, use 'O'F", N);
Set_Etype (Def_Id, Etype (First_Index (Typ)));
end if;
and then Comes_From_Source (Body_Id)
and then not Suppress_Style_Checks (Body_Id)
and then not In_Instance
+ and then Nkind (Original_Node (Body_Id))
+ /= N_Parameterized_Expression
then
Style.Body_With_No_Spec (N);
end if;
when N_Type_Conversion =>
Why_Not_Static (Expression (N));
- if not Is_Scalar_Type (Etype (Prefix (N)))
- or else not Is_Static_Subtype (Etype (Prefix (N)))
+ if not Is_Scalar_Type (Entity (Subtype_Mark (N)))
+ or else not Is_Static_Subtype (Entity (Subtype_Mark (N)))
then
Error_Msg_N
("static conversion requires static scalar subtype result " &
-- C_Pass_By_Copy is treated as a synonym for convention C (this is
-- tested again below to set the critical flag).
+
if Cname = Name_C_Pass_By_Copy then
C := Convention_C;
-- We are interested only in components and discriminants
- if Ekind_In (Ent, E_Component, E_Discriminant) then
+ Exp := Empty;
+ case Ekind (Ent) is
+ when E_Component =>
- -- Get default expression if any. If there is no declaration
- -- node, it means we have an internal entity. The parent and
- -- tag fields are examples of such entities. For these cases,
- -- we just test the type of the entity.
+ -- Get default expression if any. If there is no declaration
+ -- node, it means we have an internal entity. The parent and
+ -- tag fields are examples of such entities. For such cases,
+ -- we just test the type of the entity.
- if Present (Declaration_Node (Ent)) then
- Exp := Expression (Declaration_Node (Ent));
- else
- Exp := Empty;
- end if;
+ if Present (Declaration_Node (Ent)) then
+ Exp := Expression (Declaration_Node (Ent));
+ end if;
- -- A component has PI if it has no default expression and the
- -- component type has PI.
+ when E_Discriminant =>
- if No (Exp) then
- if not Has_Preelaborable_Initialization (Etype (Ent)) then
- Has_PE := False;
- exit;
- end if;
+ -- Note: for a renamed discriminant, the Declaration_Node
+ -- may point to the one from the ancestor, and have a
+ -- different expression, so use the proper attribute to
+ -- retrieve the expression from the derived constraint.
+
+ Exp := Discriminant_Default_Value (Ent);
- -- Require the default expression to be preelaborable
+ when others =>
+ goto Check_Next_Entity;
- elsif not Is_Preelaborable_Expression (Exp) then
+ end case;
+
+ -- A component has PI if it has no default expression and the
+ -- component type has PI.
+
+ if No (Exp) then
+ if not Has_Preelaborable_Initialization (Etype (Ent)) then
Has_PE := False;
exit;
end if;
+
+ -- Require the default expression to be preelaborable
+
+ elsif not Is_Preelaborable_Expression (Exp) then
+ Has_PE := False;
+ exit;
end if;
+ <<Check_Next_Entity>>
Next_Entity (Ent);
end loop;
end Check_Components;
--
-- Do not generate pragmas for dispatching operations.
+ S_Elim_Ignore : aliased constant S := "/IGNORE=@" &
+ "--ignore=@";
+ -- /IGNORE=filename
+ --
+ -- Do not generate pragmas for subprograms declared in the sources
+ -- listed in a specified file
+
S_Elim_Project : aliased constant S := "/PROJECT_FILE=<" &
"-P>";
-- /PROJECT_FILE=filename