This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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.

Tested on x86_64-pc-linux-gnu, committed on trunk

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.
--- gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
+++ gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
@@ -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

--- gcc/ada/gnat_ugn.texi
+++ gcc/ada/gnat_ugn.texi
@@ -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

--- gcc/ada/opt.ads
+++ gcc/ada/opt.ads
@@ -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

--- gcc/ada/repinfo.adb
+++ gcc/ada/repinfo.adb
@@ -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

--- gcc/ada/switch-c.adb
+++ gcc/ada/switch-c.adb
@@ -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)

--- gcc/ada/usage.adb
+++ gcc/ada/usage.adb
@@ -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
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]