1. 21 Aug, 2019 1 commit
    • [Ada] More complete information level for -gnatR4 output · 3c488e6c
      This instructs -gnatR4 to also list the Etype of components in
      user-declared record types if it is compiler-generated, for example in:
      
      package P3 is
      
          type idx is range 1 .. 100;
      
          type Arr is array (Idx range <>) of Character;
      
          type Rec is record
             C : Arr (1 .. 5);
          end record;
      
      end P3;
      
      2019-08-21  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Array_Info): In -gnatR4 mode, set the
      	relevant flag on the component type here instead of...
      	(List_Object_Info): Likewise for the object type.
      	(List_Entities): ...here.  In -gnatR4 mode, recurse into
      	entities local to a record type.
      	(List_Component_Layout): In -gnatR4 mode, mark the type as
      	relevant.
      
      From-SVN: r274786
      Eric Botcazou committed
  2. 20 Aug, 2019 2 commits
    • [Ada] Minor reformattings · 31fde973
      2019-08-20  Gary Dismukes  <dismukes@adacore.com>
      
      gcc/ada/
      
      	* ali.adb, ali.ads, aspects.adb, checks.ads, checks.adb,
      	doc/gnat_rm/implementation_defined_pragmas.rst,
      	doc/gnat_ugn/building_executable_programs_with_gnat.rst,
      	einfo.ads, exp_aggr.adb, exp_ch11.adb, exp_ch3.ads, exp_ch4.adb,
      	exp_disp.adb, inline.adb, libgnat/a-locale.ads,
      	libgnat/s-soflin.ads, par_sco.adb, repinfo.adb, sem_ch5.adb,
      	sem_disp.adb, sem_elab.adb, sem_eval.adb, sem_spark.adb,
      	sem_spark.ads, sinfo.ads: Minor reformattings, typo fixes and
      	and rewordings.
      
      From-SVN: r274737
      Gary Dismukes committed
    • [Ada] More complete information level for -gnatR4 output · 76ccee8f
      This instructs -gnatR4 to also list the Etype of a user-declared record
      subtype if it is compiler-generated, for example in:
      
      package P is
      
         type U_Arr is array (Integer range <>) of Character;
      
         type Rec1 (D1, D2 : Integer) is record
            C : U_Arr (D1 .. D2);
         end record;
      
         type Rec_N is new Rec1 (1, 2);
      
      end P;
      
      2019-08-20  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Record_Info): In -gnatR4 mode, set the
      	relevant flag on the implicit base type of a record subtype.
      
      From-SVN: r274727
      Eric Botcazou committed
  3. 14 Aug, 2019 1 commit
    • [Ada] Do not crash with -gnatR3 on Ghost aspects · 022c9dfe
      2019-08-14  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* sem_aux.adb (Next_Rep_Item): If a node in the rep chain
      	involves a Ghost aspect it may have been replaced by a null
      	statement; use the original node to find next Rep_Item.
      	* repinfo.adb (List_Entities): Do not list an Ignored
      	Ghost_Entity, for which information may have been deleted.
      
      From-SVN: r274470
      Ed Schonberg committed
  4. 13 Aug, 2019 1 commit
    • [Ada] Show Bit_Order and Scalar_Storage_Order in -gnatR4 output · 6aaab508
      This patch modifies the behavior of -gnatR4 so that representation
      information for bit and scalar storage order gets displayed in all cases
      and not just when defaults are overriden.
      
      ------------
      -- Source --
      ------------
      
      --  pkg.ads
      
      package Pkg is
         type Root is tagged record
           Data0 : Integer;
         end record;
      
         type Derived is new Root with record
            Data1 : Integer;
         end record;
      end Pkg;
      
      -----------------
      -- Compilation --
      -----------------
      
      $ gnatmake -gnatR4 pkg.ads
      
      Representation information for unit Pkg (spec)
      ----------------------------------------------
      
      for Root'Size use 128;
      for Root'Alignment use 8;
      for Root use record
         Data0 at 8 range  0 .. 31;
      end record;
      for Root'Bit_Order use System.Low_Order_First;
      for Root'Scalar_Storage_Order use System.Low_Order_First;
      
      for Trootc'Size use 0;
      for Trootc'Alignment use 0;
      for Trootc use record
      end record;
      for Trootc'Bit_Order use System.Low_Order_First;
      for Trootc'Scalar_Storage_Order use System.Low_Order_First;
      
      for Derived'Size use 192;
      for Derived'Alignment use 8;
      for Derived use record
         Data0 at  8 range  0 .. 31;
         Data1 at 16 range  0 .. 31;
      end record;
      for Derived'Bit_Order use System.Low_Order_First;
      for Derived'Scalar_Storage_Order use System.Low_Order_First;
      
      for Tderivedc'Size use 0;
      for Tderivedc'Alignment use 0;
      for Tderivedc use record
         Data0 at  8 range  0 .. 31;
         Data1 at 16 range  0 .. 31;
      end record;
      for Tderivedc'Bit_Order use System.Low_Order_First;
      for Tderivedc'Scalar_Storage_Order use System.Low_Order_First;i
      
      2019-08-13  Justin Squirek  <squirek@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Scalar_Storage_Order): Modify conditionals
      	for displaying ordering to always be triggered when -gnatR4 is
      	in effect.
      
      From-SVN: r274347
      Justin Squirek committed
  5. 23 Jul, 2019 1 commit
    • [Ada] Minor tweak to -gnatR output · f9534f4b
      This makes sure that the numbers present in the -gnatR output are
      printed in decimal format in all cases, since the hexadecimal format is
      not compatible with the JSON syntax.
      
      2019-07-23  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Component_Layout): Pass Decimal to UI_Write.
      	(Write_Val): Likewise.
      
      From-SVN: r273723
      Eric Botcazou committed
  6. 22 Jul, 2019 1 commit
    • [Ada] More complete information level for -gnatR4 output · 46ebb491
      This instructs -gnatR4 to also list the Etype of user-declared objects
      if it is compiler-generated, for example in:
      
      package P2 is
      
        Arr_V : array (1 .. 5) of Integer;
      
      end P2;
      
      2019-07-22  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Entities): Also list compiled-generated
      	types present as Etype of objects.
      
      From-SVN: r273697
      Eric Botcazou committed
  7. 09 Jul, 2019 3 commits
    • [Ada] Minor reformatting · 134f52b9
      2019-07-09  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* exp_ch9.adb, exp_util.adb, repinfo.adb, sem_ch12.adb,
      	sem_prag.adb, sem_res.adb, sem_spark.adb, sem_util.adb: Minor
      	reformatting.
      
      From-SVN: r273282
      Hristian Kirtchev committed
    • [Ada] Missing escape of the double quote in JSON output · fb95bfcc
      In Ada, the name of operators contains a pair of double quotes, which
      need to be properly escaped when the name appears in the JSON output of
      -gnatR.
      
      The change also ensures that formal parameters are not listed in the
      layout information, since this information is not back-annotated for
      them.
      
      2019-07-09  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Entities): Disregard formals altogether.
      	(List_Name): Properly escape the double quote in the JSON
      	output.
      
      From-SVN: r273279
      Eric Botcazou committed
    • [Ada] Make -gnatRj output strictly conforming JSON · b5d3d113
      This changes the -gnatRj output from a concatenation of entities to an
      array of entities, thus making it strictly conforming JSON and easier to
      be parsed by means of GNATColl or Python.
      
      2019-07-09  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.ads (JSON format): Adjust.
      	* repinfo.adb (Need_Blank_Line): Rename to...
      	(Need_Separator): ...this.
      	(Blank_Line): Rename to...
      	(Write_Separator): ...this and add JSON specific handling.
      	(List_Array_Info): Adjust to above renaming.
      	(List_Object_Info): Likewise.
      	(List_Record_Info): Likewise.
      	(List_Subprogram_Info): Likewise.
      	(List_Type_Info): Likewise.
      	(List_Entities): Do not set Need_Blank_Line.
      	(List_Rep_Info): Set Need_Separator and add JSON specific
      	handling. Output a single JSON stream in the  normal case.
      
      From-SVN: r273265
      Eric Botcazou committed
  8. 08 Jul, 2019 2 commits
    • [Ada] Small overhaul in Repinfo unit · 6f65c7ee
      This creates a List_Type_Info procedure to deal with type entities other
      than arrays and records at top level and a List_Common_Type_Info
      procedure to handle the common part between them.  No functional
      changes.
      
      2019-07-08  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Common_Type_Info): New procedure extracted
      	from...
      	(List_Type_Info): ...here.  Call it for the common information,
      	start with a blank line and output the linker section at the
      	end, if any.
      	(List_Mechanisms): Rename to...
      	(List_Subprogram_Info): ...this.
      	(List_Array_Info): Call List_Common_Type_Info.
      	(List_Entities): Adjust to above change and renaming.
      	(List_Record_Info): Call List_Common_Type_Info.
      
      From-SVN: r273226
      Eric Botcazou committed
    • [Ada] Fix crash on extension of private type with -gnatRj · abbc4546
      This fixes a crash (or an assertion failure) during the processing done
      for -gnatRj on the declaration of an extension of a private type.
      Generally speaking, extension declarations are delicate in this context
      because the front-end does not duplicate the structure of the parent
      type, so the processing required to output the structural layout needs
      to go up to the declaration of the parent type, which may or may not be
      available or usable.
      
      The change also makes the processing more robust by falling back to the
      flat layout if the declaration of the parent type cannot be processed.
      
      2019-07-08  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Record_Info): Declare Incomplete_Layout and
      	Not_In_Extended_Main local exceptions.
      	(List_Structural_Record_Layout): For an extension, raise the
      	former if the parent subtype has not been built and the latter
      	if it is not declared in the main source unit.  Fall back to the
      	flat layout if either exception has been raised.
      
      From-SVN: r273206
      Eric Botcazou committed
  9. 27 Jan, 2019 1 commit
    • repinfo.adb (List_Component_Layout): Remove superfluous space for zero-sized field. · 683ccd05
      	* repinfo.adb (List_Component_Layout): Remove superfluous space for
      	zero-sized field.
      	* gcc-interface/ada-tree.h (TYPE_IS_EXTRA_SUBTYPE_P): New macro.
      	* gcc-interface/gigi.h (create_extra_subtype): Declare.
      	* gcc-interface/decl.c (TYPE_ARRAY_SIZE_LIMIT): Likewise.
      	(update_n_elem): New function.
      	(gnat_to_gnu_entity): Use create_extra_subtype to create extra subtypes
      	instead of doing it manually.
      	<E_Array_Type>: Use update_n_elem to compute the maximum size.  Use the
       	index type instead of base type for the bounds. Set TYPE_ARRAY_MAX_SIZE
      	of the array to the maximum size.
      	<E_Array_Subtype>: Create an extra subtype using the index type of the
      	base array type for self-referential bounds.  Use update_n_elem to
      	compute the maximum size.  Set TYPE_ARRAY_MAX_SIZE of the array to the
      	maximum size.
      	(gnat_to_gnu_field): Clear DECL_NONADDRESSABLE_P on discriminants.
      	* gcc-interface/misc.c (gnat_get_alias_set): Return the alias set of
      	the base type for an extra subtype.
      	(gnat_type_max_size): Remove obsolete code.
      	* gcc-interface/trans.c (Attribute_to_gnu): Minor tweak.
      	(can_be_lower_p): Deal with pathological types.
      	* gcc-interface/utils.c (create_extra_subtype): New function.
      	(create_field_decl): Minor tweak.
      	(max_size) <tcc_reference>: Compute a better value by using the extra
       	subtypes on the self-referential bounds.
      	<tcc_binary>: Rewrite.  Deal with "negative value" in unsigned types.
      	<tcc_expression>: Likewise.
      	* gcc-interface/utils2.c (compare_arrays): Retrieve the original bounds
      	of the arrays upfront.  Swap only if the second length is not constant.
      	Use comparisons on the original bounds consistently for the null tests.
      	(build_binary_op): Use TYPE_IS_EXTRA_SUBTYPE_P macro.
      	(build_allocator): Minor tweak.
      
      From-SVN: r268318
      Eric Botcazou committed
  10. 08 Jan, 2019 1 commit
  11. 03 Dec, 2018 1 commit
    • [Ada] Minor reformattings · 89beb653
      2018-12-03  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* checks.adb, exp_aggr.adb, exp_attr.adb, exp_ch3.adb,
      	exp_util.adb, exp_util.ads, repinfo.adb, sem_attr.adb,
      	sem_ch3.adb, sem_res.adb, sem_util.adb: Minor reformatting.
      
      From-SVN: r266750
      Hristian Kirtchev committed
  12. 14 Nov, 2018 2 commits
    • [Ada] More complete information level for -gnatR output · b5f581cd
      This adds a 4th information level for the -gnatR output, where relevant
      compiler-generated types are listed in addition to the information
      already output by -gnatR3.
      
      For the following package P:
      
      package P is
      
        type Arr0 is array (Positive range <>) of Boolean;
      
          type Rec (D1 : Positive; D2 : Boolean) is record
             C1 : Integer;
             C2 : Arr0 (1 .. D1);
      
             case D2 is
                when False =>
                   C3 : Character;
                when True =>
                   C4 : String (1 .. 3);
                   C5 : Float;
             end case;
          end record;
      
          type Arr1 is array (1 .. 8) of Rec (1, True);
      
      end P;
      
      the output generated by -gnatR4 must be:
      
      Representation information for unit P (spec)
      --------------------------------------------
      
      for Arr0'Alignment use 1;
      for Arr0'Component_Size use 8;
      
      for Rec'Object_Size use 17179869344;
      for Rec'Value_Size use (if (#2 != 0) then ((((#1 + 15) & -4) + 8) * 8)
      else ((((#1 + 15) & -4) + 1) * 8) end);
      for Rec'Alignment use 4;
      for Rec use record
         D1 at  0 range  0 .. 31;
         D2 at  4 range  0 ..  7;
         C1 at  8 range  0 .. 31;
         C2 at 12 range  0 .. ((#1 * 8)) - 1;
         C3 at ((#1 + 15) & -4) range  0 ..  7;
         C4 at ((#1 + 15) & -4) range  0 .. 23;
         C5 at (((#1 + 15) & -4) + 4) range  0 .. 31;
      end record;
      
      for Arr1'Size use 1536;
      for Arr1'Alignment use 4;
      for Arr1'Component_Size use 192;
      
      for Tarr1c'Size use 192;
      for Tarr1c'Alignment use 4;
      for Tarr1c use record
         D1 at  0 range  0 .. 31;
         D2 at  4 range  0 ..  7;
         C1 at  8 range  0 .. 31;
         C2 at 12 range  0 ..  7;
         C4 at 16 range  0 .. 23;
         C5 at 20 range  0 .. 31;
      end record;
      
      2018-11-14  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* doc/gnat_ugn/building_executable_programs_with_gnat.rst
      	(-gnatR): Document new -gnatR4 level.
      	* gnat_ugn.texi: Regenerate.
      	* opt.ads (List_Representation_Info): Bump upper bound to 4.
      	* repinfo.adb: Add with clause for GNAT.HTable.
      	(Relevant_Entities_Size): New constant.
      	(Entity_Header_Num): New type.
      	(Entity_Hash): New function.
      	(Relevant_Entities): New set implemented with GNAT.HTable.
      	(List_Entities): Also list compiled-generated entities present
      	in the Relevant_Entities set. Consider that the Component_Type
      	of an array type is relevant.
      	(List_Rep_Info): Reset Relevant_Entities for each unit.
      	* switch-c.adb (Scan_Front_End_Switches): Add support for -gnatR4.
      	* switch-m.adb (Normalize_Compiler_Switches): Likewise
      	* usage.adb (Usage): Likewise.
      
      From-SVN: r266131
      Eric Botcazou committed
    • [Ada] Use Cancel_Special_Output instead of Set_Special_Output with null · e3548b69
      I believe Cancel_Special_Output is easier to read and thus preferred;
      otherwise, it wouldn't be introduced, so let's use it where possible.
      
      2018-11-14  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* bindgen.adb, exp_cg.adb, repinfo.adb, sprint.adb: Minor reuse
      	Cancel_Special_Output where possible.
      
      From-SVN: r266110
      Piotr Trojanek committed
  13. 09 Oct, 2018 1 commit
  14. 26 Sep, 2018 1 commit
    • [Ada] Fix assertion failure on record subtype with -gnatRj · 81d85d4b
      The JSON output of the -gnatR machinery was choking on record subtypes
      and the change fixes this oversight.
      
      The following package must now compile properly with -gnatRj:
      
      package P is
      
        type Rec (D : Integer) is record
            C : Integer;
      
            case D is
               when 1 =>
                  S : String (1 .. 20);
               when 2 =>
                  B : Boolean;
               when others =>
                  Ch1 : Character;
                  F   : Float;
                  Ch2 : Character;
            end case;
      
         end record;
      
         subtype Rec1 is Rec (1);
      
      end P;
      
      2018-09-26  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Record_Layout): Be prepared for JSON output.
      	(List_Record_Info): Use the flat representation for record
      	subtypes in the JSON format.
      
      From-SVN: r264609
      Eric Botcazou committed
  15. 31 Jul, 2018 1 commit
    • [Ada] Replace low-level calls to Ekind with high-level calls to Is_Formal · bb6a856b
      High-level wrappers are easier to read. This change came up while reading
      some code related to GNATprove, but then uniformly applied to the entire
      frontend. For the few remaining membership tests that could be replaced
      by Is_Formal it is not obvious whether the high-level routine makes the
      code better.
      
      2018-07-31  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* exp_aggr.adb, exp_ch4.adb, exp_ch6.adb, lib-xref.adb,
      	repinfo.adb, sem_ch9.adb: Minor replace Ekind membership tests
      	with a wrapper routine.
      
      From-SVN: r263093
      Piotr Trojanek committed
  16. 11 Jun, 2018 1 commit
    • [Ada] Minor tweaks in Repinfo · 972d2984
      2018-06-11  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.ads (Rep_Value): Use a single line.
      	* repinfo.adb (Rep_Value): Likewise.
      	(List_Attr): Do not use string concatenation.
      
      From-SVN: r261395
      Eric Botcazou committed
  17. 31 May, 2018 1 commit
  18. 30 May, 2018 1 commit
    • [Ada] Minor reformatting · f537fc00
      2018-05-30  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* exp_aggr.adb, exp_ch3.adb, exp_ch4.adb, exp_ch7.adb, exp_unst.adb,
      	exp_util.adb, exp_util.ads, libgnat/a-calcon.adb, libgnat/a-calcon.ads,
      	libgnat/s-os_lib.adb, repinfo.adb, sem_ch3.adb, sem_disp.adb,
      	sem_disp.ads, sem_util.adb: Minor reformatting.
      
      From-SVN: r260923
      Hristian Kirtchev committed
  19. 29 May, 2018 7 commits
    • [Ada] Plug small hole in -gnatR output · 944e24a3
      The -gnatR switch outputs representation information for locally-defined
      types but it was skipping those defined in blocks without label, unlike
      those defined in named blocks.  This change plugs this small hole.
      
      The following procedure:
      
      procedure P is
      begin
        declare
          type R is record
            I : Integer;
          end record;
        begin
          null;
        end;
      end;
      
      must now generate the following output with -gnatR:
      
      Representation information for unit P (body)
      --------------------------------------------
      
      for B_1.R'Size use 32;
      for B_1.R'Alignment use 4;
      for B_1.R use record
         I at 0 range  0 .. 31;
      end record;
      
      2018-05-29  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Entities): Also recurse into blocks without label.
      
      From-SVN: r260884
      Eric Botcazou committed
    • [Ada] Adjustment of behavior of new -gnatRj switch · de9b2a96
      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
      Eric Botcazou committed
    • [Ada] Enhance output of discriminants with -gnatR in JSON mode · 0f9ca030
      This arranges for the Discriminant_Number of discriminants to be output
      by -gnatR in JSON mode.  This number is referenced in symbolic expressions
      present for offsets and sizes, so its definition is also required for the
      sake of completeness.
      
      2018-05-29  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.ads (JSON format): Document new pair for components.
      	* repinfo.adb (Derived_Discriminant): New function.
      	(List_Structural_Record_Layout): Add Outer_Ent parameter and pass it
      	in recursive calls. If the record type is the parent of an extension,
      	find and list the derived discriminant from the extension, if any.
      	(List_Component_Layout): List the Discriminant_Number in JSON mode.
      	(List_Record_Info): Adjust call to List_Structural_Record_Layout.
      
      From-SVN: r260869
      Eric Botcazou committed
    • [Ada] Implement machine parsable format for -gnatR output · 1e7629b8
      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
      Eric Botcazou committed
    • [Ada] Factor out worker procedure for -gnatR · 7883c42e
      This extracts a worker procedure for printing the layout of a single component
      from List_Record_Layout so as to make the next change more readable.
      
      2018-05-29  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Component_Layout): New procedure extracted from...
      	(List_Record_Layout): ...here.  Invoke it.
      
      From-SVN: r260867
      Eric Botcazou committed
    • [Ada] Minor cleanup in repinfo unit · 76b382d9
      This factors out the various cases where a marker for an unknown value is
      output by the -gnatR switches.  No functional changes.
      
      2018-05-29  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (Write_Unknown_Val): New procedure.
      	(List_GCC_Expression): Call it.
      	(List_Record_Layout): Likewise.
      	(Write_Val): Likewise.
      
      From-SVN: r260866
      Eric Botcazou committed
    • [Ada] Fix irregular output with -gnatRm · 28cfa269
      The information displayed by -gnatRm was using slightly different naming
      and formatting conventions than the rest of the -gnatR information with
      no justification, so this adjusts it for the sake of consistency.
      
      For the following package:
      
      package P is
      
        function F (I : Integer) return Integer;
      
        type Rec is limited record
          I : Integer;
        end record;
      
        procedure P1 (R : Rec; I : out Integer);
      
        procedure P2 (R : Rec; I : out Integer);
        pragma Linker_Section (P2, ".my_section");
      
        package Inner is
      
          procedure P3;
      
        end Inner;
      
      end P;
      
      package body P is
      
        function F (I : Integer) return Integer is
        begin
          return I;
        end;
      
        procedure P1 (R : Rec; I : out Integer) is
        begin
          I := R.I;
        end;
      
        procedure P2 (R : Rec; I : out Integer) is
        begin
          I := R.I;
        end;
      
        package body Inner is
      
           procedure P3 is
           begin
             null;
           end;
      
        end Inner;
      
      end P;
      
      the output of -gnatRm must be:
      
      Representation information for unit P (body)
      --------------------------------------------
      
      Representation information for unit P (spec)
      --------------------------------------------
      
      function F declared at p7.ads:3:12
      convention : Ada
         I : passed by copy
      returns by copy
      
      for Rec'Size use 32;
      for Rec'Alignment use 4;
      for Rec use record
         I at 0 range  0 .. 31;
      end record;
      
      procedure P1 declared at p7.ads:9:13
      convention : Ada
         R : passed by reference
         I : passed by copy
      
      procedure P2 declared at p7.ads:11:13
      convention : Ada
         R : passed by reference
         I : passed by copy
      pragma Linker_Section (P2, ".my_section");
      
      procedure Inner.P3 declared at p7.ads:16:15
      convention : Ada
      
      2018-05-29  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Entities): Do not list the Linker_Section for
      	subprograms here...
      	(List_Mechanisms): ...but here instead.  Use consistent name output
      	and formatting conventions.
      
      From-SVN: r260861
      Eric Botcazou committed
  20. 28 May, 2018 5 commits
    • [Ada] Remove Valop from the Repinfo unit · 575e47bf
      This removes the recently added Valop as redundant.  No functional changes.
      
      2018-05-28  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_GCC_Expression): Remove Valop and replace calls to
      	it with calls to Unop.
      
      From-SVN: r260843
      Eric Botcazou committed
    • [Ada] Minor cleanup in repinfo unit · 72da915b
      This removes the Truth_Andif_Expr and Truth_Orif_Expr codes for expressions
      handled by the repinfo unit, since they are redundant with Truth_And_Expr
      and Truth_Or_Expr respectively in this context.  No functional changes.
      
      2018-05-28  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.ads (TCode): Adjust range.
      	(Truth_Andif_Expr): Remove.
      	(Truth_Orif_Expr): Likewise.
      	(Truth_And_Expr .. Dynamic_Val): Adjust value.
      	* repinfo.adb (Print_Expr): Remove handling of Truth_{And,Or}if_Expr.
      	(Rep_Value): Likewise.
      	* repinfo.h (Truth_Andif_Expr): Remove.
      	(Truth_Orif_Expr): Likewise.
      	(Truth_And_Expr .. Dynamic_Val): Adjust value.
      	* gcc-interface/decl.c (annotate_value) <TRUTH_ANDIF_EXPR>: Fall
      	through to TRUTH_AND_EXPR case.
      	<TRUTH_ORIF_EXPR>: Fall through to TRUTH_OR_EXPR case.
      
      From-SVN: r260842
      Eric Botcazou committed
    • [Ada] Crash on aspect/pragma Linked_Section with -gnatR2 · 24161618
      This patch modifies the output of the representation information related to
      aspect or pragma Linker_Section, achieved with compiler switch -gnatR2. The
      value of the section argument is now properly retrieved. Previously it was
      assumed that the value is always a N_String_Literal, however the semantics
      of the annotation allow for any static string expression, including a
      reference to a static string.
      
      ------------
      -- Source --
      ------------
      
      --  linker_sections.ads
      
      package Linker_Sections is
         LS_1 : constant String := "1";
         LS_2 : constant String := "2" & "2";
         LS_3 : constant String := LS_1 & "3";
         LS_4 : constant String := "4" & LS_2;
      
         Val_1  : Integer with Linker_Section => LS_1;
         Val_2  : Integer with Linker_Section => LS_2;
         Val_3  : Integer with Linker_Section => LS_3;
         Val_4  : Integer with Linker_Section => LS_4;
         Val_5  : Integer with Linker_Section => LS_1 & "5";
         Val_6  : Integer with Linker_Section => LS_2 & "6";
         Val_7  : Integer with Linker_Section => LS_3 & "7";
         Val_8  : Integer with Linker_Section => LS_4 & "8";
         Val_9  : Integer with Linker_Section => "9"  & LS_1;
         Val_10 : Integer with Linker_Section => "10" & LS_2;
         Val_11 : Integer with Linker_Section => "11" & LS_3;
         Val_12 : Integer with Linker_Section => "12" & LS_4;
      
         Val_13 : Integer; pragma Linker_Section (Val_13, LS_1);
         Val_14 : Integer; pragma Linker_Section (Val_14, LS_2);
         Val_15 : Integer; pragma Linker_Section (Val_15, LS_3);
         Val_16 : Integer; pragma Linker_Section (Val_16, LS_4);
         Val_17 : Integer; pragma Linker_Section (Val_17, LS_1 & "5");
         Val_18 : Integer; pragma Linker_Section (Val_18, LS_2 & "6");
         Val_19 : Integer; pragma Linker_Section (Val_19, LS_3 & "7");
         Val_20 : Integer; pragma Linker_Section (Val_20, LS_4 & "8");
         Val_21 : Integer; pragma Linker_Section (Val_21, "9"  & LS_1);
         Val_22 : Integer; pragma Linker_Section (Val_22, "10" & LS_2);
         Val_23 : Integer; pragma Linker_Section (Val_23, "11" & LS_3);
         Val_24 : Integer; pragma Linker_Section (Val_24, "12" & LS_4);
      end Linker_Sections;
      
      -----------------
      -- Compilation --
      -----------------
      
      $ gcc -c -gnatR2s linker_sections.ads
      
      2018-05-28  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (Expr_Value_S): New routine.
      	(List_Linker_Section): Properly extract the value of the section
      	argument.
      
      From-SVN: r260825
      Hristian Kirtchev committed
    • [Ada] Minor tweak to output of -gnatR · c8e95568
      This changes the output of -gnatR for extensions of tagged record types to
      avoid displaying the internal _Parent component, which overlaps with other
      components and is thus more confusing than helpful.
      
      For the following hierarchy:
      
        type R1 is tagged record
          I : Integer;
        end record;
      
        type R2 is new R1 with record
          C : Character;
        end record;
      
      the output -gnatR must now be:
      
      for R1'Object_Size use 128;
      for R1'Value_Size use 96;
      for R1'Alignment use 8;
      for R1 use record
         _Tag at 0 range  0 .. 63;
         I    at 8 range  0 .. 31;
      end record;
      
      for R2'Object_Size use 192;
      for R2'Value_Size use 136;
      for R2'Alignment use 8;
      for R2 use record
         _Tag at  0 range  0 .. 63;
         I    at  8 range  0 .. 31;
         C    at 16 range  0 ..  7;
      end record;
      
      2018-05-28  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (Compute_Max_Length): Skip _Parent component.
      	(List_Record_Layout): Likewise.
      
      From-SVN: r260819
      Eric Botcazou committed
    • [Ada] Minor internal cleanup in repinfo unit · 7672ab42
      This steamlines a bit the implementation.  No functional changes.
      
      2018-05-28  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Array_Info): Start with an explicit blank line and
      	end with the linker section, if any.
      	(List_Entities): Do not output the linker section for record types,
      	array types and variables.
      	(Print_Expr): Factor out common processing for unary operators and
      	special values.  Adjust and reorder the various cases.
      	(List_Object_Info): End with the linker section, if any.
      	(List_Record_Info): Likewise.
      	(List_Type_Info): Do not start with a blank line.
      
      From-SVN: r260815
      Eric Botcazou committed
  21. 24 May, 2018 1 commit
    • [Ada] Fix irregular output with -gnatR3 · 63a329f8
      This fixes a long-standing quirk present in the layout information for record
      types displayed by the -gnatR3 switch: when a component has a variable
      (starting) position, its corresponding line in the output has an irregular and
      awkward format.  After this change, the format is the same as in all the other
      cases.
      
      For the following record:
      
          type R (m : natural) is record
              s : string (1 .. m);
              r : natural;
              b : boolean;
          end record;
          for R'alignment use 4;
          pragma Pack (R);
      
      the output of -gnatR3 used to be:
      
      for R'Object_Size use 17179869248;
      for R'Value_Size use ((#1 + 8) * 8);
      for R'Alignment use 4;
      for R use record
         m at  0 range  0 .. 30;
         s at  4 range  0 .. ((#1 * 8)) - 1;
         r at bit offset (((#1 + 4) * 8)) size in bits = 31
         b at bit offset ((((#1 + 7) * 8) + 7)) size in bits = 1
      end record;
      
      and is changed into:
      
      for R'Object_Size use 17179869248;
      for R'Value_Size use ((#1 + 8) * 8);
      for R'Alignment use 4;
      for R use record
         m at  0 range  0 .. 30;
         s at  4 range  0 .. ((#1 * 8)) - 1;
         r at (#1 + 4) range  0 .. 30;
         b at (#1 + 7) range  7 ..  7;
      end record;
      
      2018-05-24  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* fe.h (Set_Normalized_First_Bit): Declare.
      	(Set_Normalized_Position): Likewise.
      	* repinfo.adb (List_Record_Layout): Do not use irregular output for a
      	variable position.  Fix minor spacing issue.
      	* gcc-interface/decl.c (annotate_rep): If a field has a variable
      	offset, compute the normalized position and annotate it in addition to
      	the bit offset.
      
      From-SVN: r260669
      Eric Botcazou committed
  22. 23 May, 2018 1 commit
  23. 11 Jan, 2018 1 commit
  24. 09 Oct, 2017 1 commit
    • [multiple changes] · 98b779ae
      2017-10-09  Ed Schonberg  <schonberg@adacore.com>
      
      	* exp_util.adb (Make_Predicate_Call): If the type of the expression to
      	which the predicate check applies is tagged, convert the expression to
      	that type. This is in most cases a no-op, but is relevant if the
      	expression is clas-swide, because the predicate function being invoked
      	is not a primitive of the type and cannot take a class-wide actual.
      
      2017-10-09  Gary Dismukes  <dismukes@adacore.com>
      
      	* exp_disp.adb: Minor reformatting.
      
      2017-10-09  Arnaud Charlet  <charlet@adacore.com>
      
      	* sem_warn.adb (Warn_On_Unreferenced_Entity): Fix typo.
      
      2017-10-09  Hristian Kirtchev  <kirtchev@adacore.com>
      
      	* sem_elab.adb (Install_ABE_Check): Do not generate an ABE check for
      	GNATprove.
      	(Install_ABE_Failure): Do not generate an ABE failure for GNATprove.
      
      2017-10-09  Bob Duff  <duff@adacore.com>
      
      	* exp_ch6.adb: (Make_Build_In_Place_Call_In_Object_Declaration): Return
      	immediately if the call has already been processed (by a previous call
      	to Make_Build_In_Place_Call_In_Anonymous_Context).
      	* sem_elab.adb: Minor typo fixes.
      
      2017-10-09  Ed Schonberg  <schonberg@adacore.com>
      
      	* sem_ch13.adb (Replace_Type_Ref): In the expression for a dynamic
      	predicate, do not replace an identifier that matches the type if the
      	identifier is a selector in a selected component, because this
      	indicates a reference to some homograph of the type itself, and  not to
      	the current occurence in the predicate.
      
      2017-10-09  Eric Botcazou  <ebotcazou@adacore.com>
      
      	* repinfo.adb (List_Record_Layout): Tweak formatting.
      	(Write_Val): Remove superfluous spaces in back-end layout mode.
      
      2017-10-09  Piotr Trojanek  <trojanek@adacore.com>
      
      	* sem_res.adb (Property_Error): Remove.
      	(Resolve_Actuals): check for SPARK RM 7.1.3(10) rewritten to match the
      	current wording of the rule.
      
      2017-10-09  Justin Squirek  <squirek@adacore.com>
      
      	* sem_ch3.adb (Analyze_Declarations): Add check for ghost packages
      	before analyzing a given scope due to an expression function.
      	(Uses_Unseen_Lib_Unit_Priv): Rename to Uses_Unseen_Priv.
      
      From-SVN: r253563
      Pierre-Marie de Rodat committed
  25. 25 Sep, 2017 1 commit
    • [multiple changes] · 851e9f19
      2017-09-25  Justin Squirek  <squirek@adacore.com>
      
      	* aspects.adb, bindgen.adb, clean.adb, erroutc.adb, exp_ch13.adb,
      	exp_dbug.adb, exp_unst.adb, exp_util.adb, frontend.adb, gnat1drv.adb,
      	gnatdll.adb, gnatlink.adb, gnatls.adb, gnatname.adb, gnatxref.adb,
      	gnatfind.adb, libgnat/a-cfhama.ads, libgnat/a-exetim__mingw.adb,
      	libgnat/a-strmap.adb, libgnat/a-teioed.adb, libgnat/g-alvety.ads,
      	libgnat/g-expect.adb, libgnat/g-regist.adb, libgnat/g-socket.adb,
      	libgnat/g-socthi__mingw.ads, libgnat/s-stausa.adb,
      	libgnat/s-tsmona__linux.adb, libgnat/s-tsmona__mingw.adb,
      	libgnarl/s-taenca.adb, libgnarl/s-tassta.adb, libgnarl/s-tarest.adb,
      	libgnarl/s-tpobop.adb, make.adb, makeusg.adb, namet.adb, output.ads,
      	put_scos.adb, repinfo.adb, rtsfind.adb, scn.ads, sem_attr.adb,
      	sem_aux.ads, sem_warn.ads, targparm.adb, xr_tabls.adb, xref_lib.adb:
      	Removal of ineffective use-clauses.
      	* exp_ch9.adb (Is_Simple_Barrier_Name): Check for false positives with
      	constant folded barriers.
      	* ghost.adb, sprint.adb, sem_ch10.adb, sem_warn.adb: Change access to
      	Subtype_Marks and Names list in use-clause nodes to their new singular
      	counterparts (e.g. Subtype_Mark, Name).
      	* par.adb, par-ch8.adb (Append_Use_Clause): Created to set
      	Prev_Ids and More_Ids in use-clause nodes.
      	(P_Use_Clause): Modify to take a list as a parameter.
      	(P_Use_Package_Clause, P_Use_Type_Clause): Divide names and
      	subtype_marks within an aggregate use-clauses into individual clauses.
      	* par-ch3.adb, par-ch10.adb, par-ch12.adb: Trivally modify call to
      	P_Use_Clause to match its new behavior.
      	* sem.adb (Analyze): Mark use clauses for non-overloaded entities.
      	* sem_ch4.adb (Try_One_Interp): Add sanity check to handle previous
      	errors.
      	* sem_ch6.adb (Analyze_Generic_Subprogram_Body,
      	Analyze_Subprogram_Body_Helper): Update use clause chain at the end of
      	the declarative region.
      	* sem_ch7.adb (Analyze_Package_Body_Helper): Update use clause chain
      	after analysis (Analyze_Package_Specification): Update use clause chain
      	when there is no body.
      	* sem_ch8.ads, sem_ch8.adb (Analyze_Use_Package, Analyze_Use_Type): Add
      	parameter to determine weither the installation of scopes should also
      	propagate on the use-clause "chain".
      	(Mark_Use_Clauses): Created to traverse use-clause chains and determine
      	what constitutes a valid "use" of a clause.
      	(Update_Use_Clause_Chain): Created to aggregate common machinary used
      	to clean up use-clause chains (and warn on ineffectiveness) at the end
      	of declaritive regions.
      	* sem_ch8.adb (Analyze_Package_Name): Created to perform analysis on a
      	package name from a use-package clause.
      	(Analyze_Package_Name_List): Created to perform analysis on a list of
      	package names (similar to Analyze_Package_Name).
      	(Find_Most_Prev): Created to traverse to the beginning of a given
      	use-clause chain.
      	(Most_Decendant_Use_Clause): Create to identify which clause from a
      	given set is highest in scope (not always the most prev).
      	(Use_One_Package, Use_One_Type): Major cleanup and reorganization to
      	handle the new chaining algorithm, also many changes related to
      	redundant clauses. A new parameter has also been added to force
      	installation to handle certain cases.
      	* sem_ch9.adb (Analyze_Entry_Body, Analyze_Protected_Body,
      	Analyze_Task_Body): Mark use clauses on relevant entities.
      	* sem_ch10.adb, sem_ch10.ads (Install_Context_Clauses,
      	Install_Parents): Add parameter to determine weither the installation
      	of scopes should also propagate on the use-clause "chain".
      	* sem_ch12.adb (Inline_Instance_Body): Add flag in call to
      	Install_Context to avoid redundant chaining of use-clauses.
      	* sem_ch13.adb: Minor reformatting.
      	* sem_res.adb (Resolve): Mark use clauses on operators.
      	(Resolve_Call, Resolve_Entity_Name): Mark use clauses on relevant
      	entities.
      	* sinfo.adb, sinfo.ads (Is_Effective_Use_Clause,
      	Set_Is_Effective_Use_Clause): Add new flag to N_Use_Clause nodes to
      	represent any given clause's usage/reference/necessity.
      	(Prev_Use_Clause, Set_Prev_Use_Clause): Add new field to N_Use_Clause
      	nodes to allow loose chaining of redundant clauses.
      	(Set_Used_Operations, Set_Subtype_Mark, Set_Prev_Ids, Set_Names,
      	Set_More_Ids, Set_Name): Modify set procedure calls to reflect
      	reorganization in node fields.
      	* types.ads (Source_File_Index): Adjust index bounds.
      	(No_Access_To_Source_File): New constant.
      
      2017-09-25  Ed Schonberg  <schonberg@adacore.com>
      
      	* sem_ch13.adb (Analyze_One_Aspect): In ASIS mode make a full copy of
      	the expression to be used in the generated attribute specification
      	(rather than relocating it) to avoid resolving a potentially malformed
      	tree when the expression is resolved through an ASIS-specific call to
      	Resolve_Aspect_Expressions.  This manifests itself as a crash on a
      	function with parameter associations.
      
      From-SVN: r253144
      Pierre-Marie de Rodat committed