From: Eric Botcazou Date: Tue, 29 May 2018 09:39:44 +0000 (+0000) Subject: [Ada] Adjustment of behavior of new -gnatRj switch X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=de9b2a969ebc6ebce82331c67c895a0f99b0cc78;p=gcc.git [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 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) : Remove incompatibility check between -gnatRj and -gnatRs. * usage.adb (Usage): Adjust description of -gnatRj. From-SVN: r260873 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6aea3c0b2a9..08dfb851a59 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2018-05-29 Eric Botcazou + + * 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) : Remove incompatibility + check between -gnatRj and -gnatRs. + * usage.adb (Usage): Adjust description of -gnatRj. + 2018-05-29 Pascal Obry * libgnat/s-os_lib.adb (Normalize_Pathname): Fix handling of ".." in diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst index bbcef082c5c..4800138a635 100644 --- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst +++ b/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 diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 3fb6af5ac12..0b6a408518c 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/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 diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index 235ca3d4a62..7e23d1dfb50 100644 --- a/gcc/ada/opt.ads +++ b/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 diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index 6c354238372..1a85c8ff90e 100644 --- a/gcc/ada/repinfo.adb +++ b/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 diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index be8fb61e50c..ab7c2b30c49 100644 --- a/gcc/ada/switch-c.adb +++ b/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) diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index a07629e0e01..a065244c110 100644 --- a/gcc/ada/usage.adb +++ b/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