diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-15 10:26:33 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-15 10:26:33 +0000 |
commit | c970afb73a4d0516216b792baf6071d0077c222a (patch) | |
tree | 447369126eb4e677e186ff36876e121c754064be /gcc/ada/freeze.adb | |
parent | a0d9619fa08b438aaeda58cb70100b803942e9fe (diff) | |
download | gcc-c970afb73a4d0516216b792baf6071d0077c222a.tar.gz |
2009-04-15 Hristian Kirtchev <kirtchev@adacore.com>
* a-calend.adb: Add new constant Nanos_In_Four_Years.
(Formatting_Operations.Time_Of): Change the way four year chunks of
nanoseconds are added to the intermediate result.
2009-04-15 Nicolas Setton <setton@adacore.com>
* sysdep.c: Add __APPLE__ in the list of systems where get_immediate
does not need to wait for a carriage return.
2009-04-15 Tristan Gingold <gingold@adacore.com>
* bindgen.adb: Do not generate adafinal if No_Finalization restriction
is set.
2009-04-15 Ed Schonberg <schonberg@adacore.com>
* freeze.adb (Freeze_Entity): improve error message for improper use of
incomplete types.
Diagnose additional illegal uses of incomplete types in formal parts.
appearing in formal parts.
* sem_ch6.adb (Process_Formals, Analyze_Return_Type): ditto.
2009-04-15 Robert Dewar <dewar@adacore.com>
* exp_ch4.adb (Expand_N_Allocator): Install test for object too large.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146098 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r-- | gcc/ada/freeze.adb | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 31b41d51470..88ea26929cc 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -2606,10 +2606,10 @@ package body Freeze is ("?foreign convention function& should not " & "return unconstrained array!", E); - -- Ada 2005 (AI-326): Check wrong use of tagged + -- Ada 2005 (AI-326): Check wrong use of -- incomplete type - -- type T is tagged; + -- type T; -- tagged or just incomplete. -- function F (X : Boolean) return T; -- ERROR -- The type must be declared in the current scope for the @@ -2617,13 +2617,11 @@ package body Freeze is -- when the construct that mentions it is frozen. elsif Ekind (Etype (E)) = E_Incomplete_Type - and then Is_Tagged_Type (Etype (E)) and then No (Full_View (Etype (E))) and then not Is_Value_Type (Etype (E)) then - Error_Msg_N - ("(Ada 2005): invalid use of tagged incomplete type", - E); + Error_Msg_NE + ("invalid use of incomplete type&", E, Etype (E)); end if; end if; end; @@ -3510,10 +3508,25 @@ package body Freeze is -- For access subprogram, freeze types of all formals, the return -- type was already frozen, since it is the Etype of the function. + -- Formal types can be tagged Taft amendment types, but otherwise + -- they cannot be incomplete; elsif Ekind (E) = E_Subprogram_Type then Formal := First_Formal (E); + while Present (Formal) loop + if Ekind (Etype (Formal)) = E_Incomplete_Type + and then No (Full_View (Etype (Formal))) + and then not Is_Value_Type (Etype (Formal)) + then + if Is_Tagged_Type (Etype (Formal)) then + null; + else + Error_Msg_NE + ("invalid use of incomplete type&", E, Etype (Formal)); + end if; + end if; + Freeze_And_Append (Etype (Formal), Loc, Result); Next_Formal (Formal); end loop; @@ -3522,16 +3535,15 @@ package body Freeze is -- Ada 2005 (AI-326): Check wrong use of tag incomplete type - -- type T is tagged; + -- type T; -- tagged or untagged, may be from limited view; -- type Acc is access function (X : T) return T; -- ERROR if Ekind (Etype (E)) = E_Incomplete_Type - and then Is_Tagged_Type (Etype (E)) and then No (Full_View (Etype (E))) and then not Is_Value_Type (Etype (E)) then - Error_Msg_N - ("(Ada 2005): invalid use of tagged incomplete type", E); + Error_Msg_NE + ("invalid use of incomplete type&", E, Etype (E)); end if; -- For access to a protected subprogram, freeze the equivalent type @@ -3557,12 +3569,11 @@ package body Freeze is end if; if Ekind (Etyp) = E_Incomplete_Type - and then Is_Tagged_Type (Etyp) and then No (Full_View (Etyp)) and then not Is_Value_Type (Etype (E)) then - Error_Msg_N - ("(Ada 2005): invalid use of tagged incomplete type", E); + Error_Msg_NE + ("invalid use of incomplete type&", E, Etyp); end if; end; |