Commit de9b2a96 by Eric Botcazou Committed by Pierre-Marie de Rodat

[Ada] Adjustment of behavior of new -gnatRj switch

This decouples -gnatRj from the destination, either standard output or file,
so that it only toggles the format of the representation information.

2018-05-29  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* doc/gnat_ugn/building_executable_programs_with_gnat.rst (Debugging
	Control): Adjust description of -gnatRj.
	* gnat_ugn.texi: Regenerate.
	* opt.ads (List_Representation_Info_To_JSON): Likewise.
	* repinfo.adb (List_Rep_Info): Do not automatically create a file
	if List_Representation_Info_To_JSON is true.
	* switch-c.adb (Scan_Front_End_Switches) <R>: Remove incompatibility
	check between -gnatRj and -gnatRs.
	* usage.adb (Usage): Adjust description of -gnatRj.

From-SVN: r260873
parent ce09c3c0
2018-05-29 Eric Botcazou <ebotcazou@adacore.com>
* doc/gnat_ugn/building_executable_programs_with_gnat.rst (Debugging
Control): Adjust description of -gnatRj.
* gnat_ugn.texi: Regenerate.
* opt.ads (List_Representation_Info_To_JSON): Likewise.
* repinfo.adb (List_Rep_Info): Do not automatically create a file
if List_Representation_Info_To_JSON is true.
* switch-c.adb (Scan_Front_End_Switches) <R>: Remove incompatibility
check between -gnatRj and -gnatRs.
* usage.adb (Usage): Adjust description of -gnatRj.
2018-05-29 Pascal Obry <obry@adacore.com>
* libgnat/s-os_lib.adb (Normalize_Pathname): Fix handling of ".." in
......
......@@ -5813,16 +5813,16 @@ Debugging Control
subprogram conventions and parameter passing mechanisms for all the
subprograms are included.
If the switch is followed by a ``j`` (e.g., :switch:`-gnatRj`), then
the output is in 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.
If the switch is followed by an ``s`` (e.g., :switch:`-gnatR3s`), then
the output is to a file with the name :file:`file.rep` where file is
the name of the corresponding source file.
If the switch is followed by a ``j`` (e.g., :switch:`-gnatR3j`), then
the output is to a file with the name :file:`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.
the name of the corresponding source file, except if `j`` is also
specified, in which case the file name is :file:`file.json`.
Note that it is possible for record components to have zero size. In
this case, the component clause uses an obvious extension of permitted
......
......@@ -15041,16 +15041,16 @@ If the switch is followed by an @code{m} (e.g. @code{-gnatRm}), then
subprogram conventions and parameter passing mechanisms for all the
subprograms are included.
If the switch is followed by a @code{j} (e.g., @code{-gnatRj}), then
the output is in 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.
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.
the name of the corresponding source file, except if @cite{j`} is also
specified, in which case the file name is @code{file.json}.
Note that it is possible for record components to have zero size. In
this case, the component clause uses an obvious extension of permitted
......
......@@ -1006,8 +1006,7 @@ package Opt is
List_Representation_Info_To_JSON : Boolean := False;
-- GNAT
-- Set true by -gnatRj switch. Causes information from -gnatR/1/2/3/m to be
-- written to file.json (where file is the name of the source file) in the
-- JSON data interchange format.
-- output in the JSON data interchange format.
List_Representation_Info_Mechanisms : Boolean := False;
-- GNAT
......
......@@ -1711,20 +1711,21 @@ package body Repinfo is
-- Normal case, list to standard output
if not List_Representation_Info_To_File
and then not List_Representation_Info_To_JSON
then
Write_Eol;
Write_Str ("Representation information for unit ");
Write_Unit_Name (Unit_Name (U));
Col := Column;
Write_Eol;
for J in 1 .. Col - 1 loop
Write_Char ('-');
end loop;
if not List_Representation_Info_To_File then
if not List_Representation_Info_To_JSON then
Write_Eol;
Write_Str ("Representation information for unit ");
Write_Unit_Name (Unit_Name (U));
Col := Column;
Write_Eol;
for J in 1 .. Col - 1 loop
Write_Char ('-');
end loop;
Write_Eol;
end if;
Write_Eol;
List_Entities (Cunit_Entity (U), Bytes_Big_Endian);
-- List representation information to file
......
......@@ -1227,12 +1227,10 @@ package body Switch.C is
Ptr := Ptr + 1;
end loop;
if List_Representation_Info_To_JSON then
if List_Representation_Info_To_File then
Osint.Fail ("-gnatRs is incompatible with -gnatRj");
elsif List_Representation_Info_Extended then
Osint.Fail ("-gnatRe is incompatible with -gnatRj");
end if;
if List_Representation_Info_To_JSON
and then List_Representation_Info_Extended
then
Osint.Fail ("-gnatRe is incompatible with -gnatRj");
end if;
-- -gnats (syntax check only)
......
......@@ -403,10 +403,10 @@ begin
Write_Switch_Char ("R?");
Write_Line
("List rep info (?=0/1/2/3/e/m for none/types/all/symbolic/ext/mech)");
Write_Switch_Char ("R?j");
Write_Line ("List rep info in the JSON data interchange format");
Write_Switch_Char ("R?s");
Write_Line ("List rep info to file.rep instead of standard output");
Write_Switch_Char ("R?j");
Write_Line ("List rep info to file.json instead of standard output");
-- Line for -gnats switch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment