+2014-02-24 Ed Schonberg <schonberg@adacore.com>
+
+ * par-ch3.adb (P_Basic_Declarative_Items): If an improper body
+ appears in a list of basic declarations, complete the tree with
+ an empty statement list, to prevent cascaded errors and crashes
+ if semantic analysis is attempted.
+
2014-02-24 Thomas Quinot <quinot@adacore.com>
* g-sercom-mingw.adb (Open): Fix incorrect test for error return
then
Error_Msg ("proper body not allowed in package spec", Sloc (Decl));
+ -- Complete declaration of mangled subprogram body, for better
+ -- recovery if analysis is attempted.
+
+ if Nkind_In
+ (Decl, N_Subprogram_Body, N_Package_Body, N_Task_Body)
+ then
+ Set_Handled_Statement_Sequence (Decl,
+ Make_Handled_Sequence_Of_Statements (Sloc (Decl),
+ Statements => New_List));
+ end if;
+
-- Test for body stub scanned, not acceptable as basic decl item
elsif Kind in N_Body_Stub then
-- be used by other predefined packages. User access to this package is via
-- a renaming of this package in GNAT.OS_Lib (file g-os_lib.ads).
+-- Note: a distinct body for this spec is included in the .NET runtime library
+-- and must be kept in sync with changes made in this file.
+
pragma Compiler_Unit;
with System;
Formal_Spec : Node_Id;
begin
Formal_Spec := First (Parameter_Specifications (New_Spec));
+
+ -- Create a new formal parameter at the same source position
+
while Present (Formal_Spec) loop
Set_Defining_Identifier
(Formal_Spec,
- Make_Defining_Identifier (Sloc (Formal_Spec),
+ Make_Defining_Identifier
+ (Sloc (Defining_Identifier (Formal_Spec)),
Chars => Chars (Defining_Identifier (Formal_Spec))));
Next (Formal_Spec);
end loop;