diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2018-05-29 09:36:51 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-05-29 09:36:51 +0000 |
commit | 1e7629b8a2f2b05194ab8bc3878f6f841666a289 (patch) | |
tree | 1efd669ea62ee925e3ed67e0fff0b0193d000568 /gcc/ada/gnat_ugn.texi | |
parent | 7883c42e3ffab6c1a87e22637384cf2c80193055 (diff) | |
download | gcc-1e7629b8a2f2b05194ab8bc3878f6f841666a289.zip gcc-1e7629b8a2f2b05194ab8bc3878f6f841666a289.tar.gz gcc-1e7629b8a2f2b05194ab8bc3878f6f841666a289.tar.bz2 |
[Ada] Implement machine parsable format for -gnatR output
This adds a new variant to the -gnatR switch, namely -gnatRj, which causes
the compiler to output representation information to a file in the JSON
data interchange format. It can be combined with -gnatR0/1/2/3/m (but is
incompatible with -gnaRe and -gnatRs).
The information output in this mode is a superset of that output in the
traditional -gnatR mode, but is otherwise equivalent for the common part.
2018-05-29 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* doc/gnat_ugn/building_executable_programs_with_gnat.rst (Alphabetical
List of All Switches): Document -gnatRj.
(Debugging Control): Likewise.
* gnat_ugn.texi: Regenerate.
* opt.ads (List_Representation_Info_To_JSON): New boolean variable.
* osint-c.adb (Create_Repinfo_File): Use the .json instead of .rep
extension if List_Representation_Info_To_JSON is true.
* repinfo.ads: Document the JSON output format.
* repinfo.adb (List_Location): New procedure.
(List_Array_Info): Add support for JSON output.
(List_Entities): Likewise.
(Unop): Likewise.
(Binop): Likewise.
(Print_Expr): Likewise.
(List_Linker_Section): Likewise.
(List_Mechanisms): Likewise.
(List_Name): Likewise.
(List_Object_Info): Likewise.
(List_Record_Info): Likewise.
(List_Component_Layout): Likewise. Add Indent parameter.
(List_Structural_Record_Layout): New procedure.
(List_Attr): Add support for JSON output.
(List_Type_Info): Likewise.
(Write_Unknown_Val): Likewise.
* switch-c.adb (Scan_Front_End_Switches) <R>: Deal with 'j'.
* usage.adb (Usage): List -gnatRj.
From-SVN: r260868
Diffstat (limited to 'gcc/ada/gnat_ugn.texi')
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index ceadb57..3fb6af5 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -9898,7 +9898,7 @@ Treat pragma Restrictions as Restriction_Warnings. @table @asis -@item @code{-gnatR[0/1/2/3][e][m][s]} +@item @code{-gnatR[0|1|2|3][e][j][m][s]} Output representation information for declared types, objects and subprograms. Note that this switch is not allowed if a previous @@ -15013,7 +15013,7 @@ restriction warnings rather than restrictions. @table @asis -@item @code{-gnatR[0|1|2|3][e][m][s]} +@item @code{-gnatR[0|1|2|3][e][j][m][s]} This switch controls output from the compiler of a listing showing representation information for declared types, objects and subprograms. @@ -15045,6 +15045,13 @@ If the switch is followed by an @code{s} (e.g., @code{-gnatR3s}), then the output is to a file with the name @code{file.rep} where file is the name of the corresponding source file. +If the switch is followed by a @code{j} (e.g., @code{-gnatR3j}), then +the output is to a file with the name @code{file.json} where file is +the name of the corresponding source file, and it uses the JSON data +interchange format specified by the ECMA-404 standard. The semantic +description of this JSON output is available in the specification of +the Repinfo unit present in the compiler sources. + Note that it is possible for record components to have zero size. In this case, the component clause uses an obvious extension of permitted Ada syntax, for example @code{at 0 range 0 .. -1}. |