[multiple changes]

2011-08-03  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb: guard against error nodes in return statements.

2011-08-03  Arnaud Charlet  <charlet@adacore.com>

	* errout.adb (Error_Msg_Internal): the main unit has not been read yet,
	a warning can only appear on a configuration file, so emit warning
	without further checks.

2011-08-03  Arnaud Charlet  <charlet@adacore.com>

	* s-interr.ads: add overriding keyword.

2011-08-03  Geert Bosch  <bosch@adacore.com>

	* exp_attr.adb: Fix minor typo.

2011-08-03  Ed Schonberg  <schonberg@adacore.com>

	* par-ch4.adb: improve error recovery.

From-SVN: r177245
This commit is contained in:
Arnaud Charlet 2011-08-03 11:26:00 +02:00
parent c0e538ad80
commit 4ee646da94
6 changed files with 57 additions and 7 deletions

View File

@ -1,3 +1,25 @@
2011-08-03 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb: guard against error nodes in return statements.
2011-08-03 Arnaud Charlet <charlet@adacore.com>
* errout.adb (Error_Msg_Internal): the main unit has not been read yet,
a warning can only appear on a configuration file, so emit warning
without further checks.
2011-08-03 Arnaud Charlet <charlet@adacore.com>
* s-interr.ads: add overriding keyword.
2011-08-03 Geert Bosch <bosch@adacore.com>
* exp_attr.adb: Fix minor typo.
2011-08-03 Ed Schonberg <schonberg@adacore.com>
* par-ch4.adb: improve error recovery.
2011-08-03 Emmanuel Briot <briot@adacore.com>
* prj-part.adb, prj-part.ads, prj-makr.adb, prj-pars.adb, prj-conf.adb,

View File

@ -751,6 +751,12 @@ package body Errout is
if In_Extended_Main_Source_Unit (Sptr) then
null;
-- If the main unit has not been read yet. the warning must be on
-- a configuration file: gnat.adc or user-defined.
elsif No (Cunit (Main_Unit)) then
null;
-- If the flag location is not in the main extended source unit, then
-- we want to eliminate the warning, unless it is in the extended
-- main code unit and we want warnings on the instance.

View File

@ -4998,7 +4998,7 @@ package body Exp_Attr is
-- Value --
-----------
-- Value attribute is handled in separate unti Exp_Imgv
-- Value attribute is handled in separate unit Exp_Imgv
when Attribute_Value =>
Exp_Imgv.Expand_Value_Attribute (N);

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2011, 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- --
@ -606,8 +606,18 @@ package body Ch4 is
raise Error_Resync;
elsif Token /= Tok_Right_Paren then
T_Right_Paren;
raise Error_Resync;
if Token = Tok_Arrow then
-- This may be an aggregate that is missing a qualification
Error_Msg_SC
("context of aggregate must be a qualified expression");
raise Error_Resync;
else
T_Right_Paren;
raise Error_Resync;
end if;
else
Scan; -- past right paren

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --
@ -256,6 +256,7 @@ package System.Interrupts is
(Object : access Static_Interrupt_Protection) return Boolean;
-- Returns True
overriding
procedure Finalize (Object : in out Static_Interrupt_Protection);
-- Restore previous handlers as required by C.3.1(12) then call
-- Finalize (Protection).

View File

@ -628,8 +628,19 @@ package body Sem_Ch6 is
if Nkind (N) = N_Simple_Return_Statement then
Expr := Expression (N);
Analyze_And_Resolve (Expr, R_Type);
Check_Limited_Return (Expr);
-- Guard against a malformed expression. The parser may have
-- tried to recover but the node is not analyzable.
if Nkind (Expr) = N_Error then
Set_Etype (Expr, Any_Type);
Expander_Mode_Save_And_Set (False);
return;
else
Analyze_And_Resolve (Expr, R_Type);
Check_Limited_Return (Expr);
end if;
-- RETURN only allowed in SPARK is as the last statement function