diff options
author | Robert Dewar <dewar@adacore.com> | 2007-06-06 12:43:09 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2007-06-06 12:43:09 +0200 |
commit | 8f7770f9f85cbf63fa11291f7c5ad1b3962b918f (patch) | |
tree | df009ee8984411f034373abb688e8fab5d3abd85 | |
parent | 8909e1edc6c67c2946ebf4d2581edd7126e6aa12 (diff) | |
download | gcc-8f7770f9f85cbf63fa11291f7c5ad1b3962b918f.zip gcc-8f7770f9f85cbf63fa11291f7c5ad1b3962b918f.tar.gz gcc-8f7770f9f85cbf63fa11291f7c5ad1b3962b918f.tar.bz2 |
sem_ch13.adb (Analyze_Attribute_Definition_Clause, [...]): Check for restriction No_Implementation_Attributes if in Ada 95 mode.
2007-04-20 Robert Dewar <dewar@adacore.com>
Arnaud Charlet <charlet@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause, case Stream_Size):
Check for restriction No_Implementation_Attributes if in Ada 95 mode.
(Storage_Pool): Do not crash when RE_Stack_Bounded_Pool is not available
(Analyze_Attribute_Definition_Clause [External_Tag]): Generate error
message when using a VM, since this attribute is not supported.
(Analyze_Record_Representation_Clause): Give unrepped component warnings
* usage.adb: Add new warning for renaming of function return objects
Indicate that -gnatwp and -gnatwP concern front-end inlining
Add line for -gnatyg
Add usage information for -gnatw.c/C
From-SVN: r125449
-rw-r--r-- | gcc/ada/sem_ch13.adb | 77 | ||||
-rw-r--r-- | gcc/ada/usage.adb | 32 |
2 files changed, 91 insertions, 18 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index e6925f3..981fc40 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2007, 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- -- @@ -31,6 +31,7 @@ with Errout; use Errout; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Lib; use Lib; +with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; @@ -1052,7 +1053,13 @@ package body Sem_Ch13 is ("static string required for tag name!", Nam); end if; - Set_Has_External_Tag_Rep_Clause (U_Ent); + if VM_Target = No_VM then + Set_Has_External_Tag_Rep_Clause (U_Ent); + else + Error_Msg_Name_1 := Attr; + Error_Msg_N + ("% attribute unsupported in this configuration", Nam); + end if; end External_Tag; ----------- @@ -1362,8 +1369,10 @@ package body Sem_Ch13 is -- type Q is access Float; -- for Q'Storage_Size use T'Storage_Size; -- incorrect - if Base_Type (T) = RTE (RE_Stack_Bounded_Pool) then - Error_Msg_N ("non-sharable internal Pool", Expr); + if RTE_Available (RE_Stack_Bounded_Pool) + and then Base_Type (T) = RTE (RE_Stack_Bounded_Pool) + then + Error_Msg_N ("non-shareable internal Pool", Expr); return; end if; @@ -1502,6 +1511,10 @@ package body Sem_Ch13 is Size : constant Uint := Static_Integer (Expr); begin + if Ada_Version <= Ada_95 then + Check_Restriction (No_Implementation_Attributes, N); + end if; + if Has_Stream_Size_Clause (U_Ent) then Error_Msg_N ("Stream_Size already given for &", Nam); @@ -2076,6 +2089,9 @@ package body Sem_Ch13 is -- that the back-end can compute and back-annotate properly the -- size and alignment of types that may include this record. + -- This seems dubious, this destroys the source tree in a manner + -- not detectable by ASIS ??? + if Operating_Mode = Check_Semantics and then ASIS_Mode then @@ -2116,9 +2132,9 @@ package body Sem_Ch13 is return; end if; - -- If a tag is present, then create a component clause that places - -- it at the start of the record (otherwise gigi may place it after - -- other fields that have rep clauses). + -- If a tag is present, then create a component clause that places it + -- at the start of the record (otherwise gigi may place it after other + -- fields that have rep clauses). Fent := First_Entity (Rectype); @@ -2570,6 +2586,51 @@ package body Sem_Ch13 is Next_Component_Or_Discriminant (Comp); end loop; + + -- If no Complete_Representation pragma, warn if missing components + + elsif Warn_On_Unrepped_Components + and then not Warnings_Off (Rectype) + then + declare + Num_Repped_Components : Nat := 0; + Num_Unrepped_Components : Nat := 0; + + begin + -- First count number of repped and unrepped components + + Comp := First_Component_Or_Discriminant (Rectype); + while Present (Comp) loop + if Present (Component_Clause (Comp)) then + Num_Repped_Components := Num_Repped_Components + 1; + else + Num_Unrepped_Components := Num_Unrepped_Components + 1; + end if; + + Next_Component_Or_Discriminant (Comp); + end loop; + + -- We are only interested in the case where there is at least one + -- unrepped component, and at least half the components have rep + -- clauses. We figure that if less than half have them, then the + -- partial rep clause is really intentional. + + if Num_Unrepped_Components > 0 + and then Num_Unrepped_Components < Num_Repped_Components + then + Comp := First_Component_Or_Discriminant (Rectype); + while Present (Comp) loop + if No (Component_Clause (Comp)) then + Error_Msg_Sloc := Sloc (Comp); + Error_Msg_NE + ("?no component clause given for & declared #", + N, Comp); + end if; + + Next_Component_Or_Discriminant (Comp); + end loop; + end if; + end; end if; end Analyze_Record_Representation_Clause; @@ -3472,7 +3533,7 @@ package body Sem_Ch13 is Specification => Build_Spec); -- For a tagged type, there is always a visible declaration for each - -- stream TSS (it is a predefined primitive operation), and the for the + -- stream TSS (it is a predefined primitive operation), and the -- completion of this declaration occurs at the freeze point, which is -- not always visible at places where the attribute definition clause is -- visible. So, we create a dummy entity here for the purpose of diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index 1da60ac..037c6b1 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2007, 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- -- @@ -24,11 +24,12 @@ -- -- ------------------------------------------------------------------------------ -with Hostparm; -with Namet; use Namet; -with Opt; use Opt; -with Osint; use Osint; -with Output; use Output; +with Targparm; use Targparm; +with Namet; use Namet; +with Opt; use Opt; +with Osint; use Osint; +with Output; use Output; + with System.WCh_Con; use System.WCh_Con; procedure Usage is @@ -40,6 +41,10 @@ procedure Usage is -- than 5 characters, the maximum allowed, Write_Switch_Char will -- always output exactly 12 characters. + ----------------------- + -- Write_Switch_Char -- + ----------------------- + procedure Write_Switch_Char (Sw : String; Prefix : String := "gnat") is begin Write_Str (" -"); @@ -84,9 +89,9 @@ begin Write_Eol; - -- Common GCC switches not available in JGNAT + -- Common GCC switches not available in JGNAT/MGNAT - if not Hostparm.Java_VM then + if VM_Target = No_VM then Write_Switch_Char ("fstack-check ", ""); Write_Line ("Generate stack checking code"); @@ -361,6 +366,8 @@ begin "(not multiple of small)"); Write_Line (" c turn on warnings for constant conditional"); Write_Line (" C* turn off warnings for constant conditional"); + Write_Line (" .c turn on warnings for unrepped components"); + Write_Line (" .C* turn off warnings for unrepped components"); Write_Line (" d turn on warnings for implicit dereference"); Write_Line (" D* turn off warnings for implicit dereference"); Write_Line (" e treat all warnings as errors"); @@ -389,14 +396,18 @@ begin Write_Line (" n* normal warning mode (cancels -gnatws/-gnatwe)"); Write_Line (" o* turn on warnings for address clause overlay"); Write_Line (" O turn off warnings for address clause overlay"); - Write_Line (" p turn on warnings for ineffective pragma Inline"); - Write_Line (" P* turn off warnings for ineffective pragma Inline"); + Write_Line (" p turn on warnings for ineffective pragma " & + "Inline in frontend"); + Write_Line (" P* turn off warnings for ineffective pragma " & + "Inline in frontend"); Write_Line (" q* turn on warnings for questionable " & "missing parentheses"); Write_Line (" Q turn off warnings for questionable " & "missing parentheses"); Write_Line (" r turn on warnings for redundant construct"); Write_Line (" R* turn off warnings for redundant construct"); + Write_Line (" .r turn on warnings for object renaming function"); + Write_Line (" .R* turn off warnings for object renaming function"); Write_Line (" s suppress all warnings"); Write_Line (" t turn on warnings for tracking deleted code"); Write_Line (" T* turn off warnings for tracking deleted code"); @@ -460,6 +471,7 @@ begin Write_Line (" d check no DOS line terminators"); Write_Line (" e check end/exit labels present"); Write_Line (" f check no form feeds/vertical tabs in source"); + Write_Line (" g check standard GNAT style rules"); Write_Line (" h check no horizontal tabs in source"); Write_Line (" i check if-then layout"); Write_Line (" I check mode in"); |