diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-14 13:01:07 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-14 13:01:07 +0000 |
commit | f7481a38a55dc74533df92ce4ae4d8c401c0d3fb (patch) | |
tree | 098473a5e47938dcfa8b53ff687d42c7e5548626 /gcc/ada/lib-writ.adb | |
parent | e10ece15713783d70e450b5c28d1b24eebd10764 (diff) | |
download | gcc-f7481a38a55dc74533df92ce4ae4d8c401c0d3fb.tar.gz |
2010-06-14 Robert Dewar <dewar@adacore.com>
* ali.adb (Scan_ALI): Implement reading and storing of N lines
(Known_ALI_Lines): Add entry for 'N' (notes)
* ali.ads (Notes): New table to store Notes information
* alloc.ads: Add entries for Notes table
* lib-util.adb (Write_Info_Int): New procedure
(Write_Info_Slit): New procedure
(Write_Info_Uint): New procedure
* lib-util.ads (Write_Info_Int): New procedure
(Write_Info_Slit): New procedure
(Write_Info_Uint): New procedure
* lib-writ.adb (Write_Unit_Information): Output N (notes) lines
* lib-writ.ads: Update documentation for N (Notes) lines
* lib.adb (Store_Note): New procedure
* lib.ads (Notes): New table
(Store_Note): New procedure
* sem_prag.adb: Call Store_Note for affected pragmas
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160736 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/lib-writ.adb')
-rw-r--r-- | gcc/ada/lib-writ.adb | 94 |
1 files changed, 71 insertions, 23 deletions
diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb index 94d4b455526..24cce9251a3 100644 --- a/gcc/ada/lib-writ.adb +++ b/gcc/ada/lib-writ.adb @@ -592,42 +592,90 @@ package body Lib.Writ is for J in 1 .. Linker_Option_Lines.Last loop declare - S : constant Linker_Option_Entry := - Linker_Option_Lines.Table (J); - C : Character; - + S : Linker_Option_Entry renames Linker_Option_Lines.Table (J); begin if S.Unit = Unit_Num then Write_Info_Initiate ('L'); - Write_Info_Str (" """); + Write_Info_Char (' '); + Write_Info_Slit (S.Option); + Write_Info_EOL; + end if; + end; + end loop; + + -- Output notes + + for J in 1 .. Notes.Last loop + declare + N : constant Node_Id := Notes.Table (J).Pragma_Node; + L : constant Source_Ptr := Sloc (N); + U : constant Unit_Number_Type := Notes.Table (J).Unit; + C : Character; - for J in 1 .. String_Length (S.Option) loop - C := Get_Character (Get_String_Char (S.Option, J)); + begin + if U = Unit_Num then + Write_Info_Initiate ('N'); + Write_Info_Char (' '); + + case Chars (Pragma_Identifier (N)) is + when Name_Annotate => + C := 'A'; + when Name_Comment => + C := 'C'; + when Name_Ident => + C := 'I'; + when Name_Title => + C := 'T'; + when Name_Subtitle => + C := 'S'; + when others => + raise Program_Error; + end case; + + Write_Info_Char (C); + Write_Info_Int (Int (Get_Logical_Line_Number (L))); + Write_Info_Char (':'); + Write_Info_Int (Int (Get_Column_Number (L))); - if C in Character'Val (16#20#) .. Character'Val (16#7E#) - and then C /= '{' - then - Write_Info_Char (C); + declare + A : Node_Id; - if C = '"' then - Write_Info_Char (C); + begin + A := First (Pragma_Argument_Associations (N)); + while Present (A) loop + Write_Info_Char (' '); + + if Chars (A) /= No_Name then + Write_Info_Name (Chars (A)); + Write_Info_Char (':'); end if; - else declare - Hex : constant array (0 .. 15) of Character := - "0123456789ABCDEF"; + Expr : constant Node_Id := Expression (A); begin - Write_Info_Char ('{'); - Write_Info_Char (Hex (Character'Pos (C) / 16)); - Write_Info_Char (Hex (Character'Pos (C) mod 16)); - Write_Info_Char ('}'); + if Nkind (Expr) = N_Identifier then + Write_Info_Name (Chars (Expr)); + + elsif Nkind (Expr) = N_Integer_Literal + and then Is_Static_Expression (Expr) + then + Write_Info_Uint (Intval (Expr)); + + elsif Nkind (Expr) = N_String_Literal + and then Is_Static_Expression (Expr) + then + Write_Info_Slit (Strval (Expr)); + + else + Write_Info_Str ("<expr>"); + end if; end; - end if; - end loop; - Write_Info_Char ('"'); + Next (A); + end loop; + end; + Write_Info_EOL; end if; end; |