Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/811418/?format=api
{ "id": 811418, "url": "http://patchwork.ozlabs.org/api/1.2/patches/811418/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20170908092514.GA16335@adacore.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.2/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170908092514.GA16335@adacore.com>", "list_archive_url": null, "date": "2017-09-08T09:25:14", "name": "[Ada] Implement extended version of -gnatR for record sub-components", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "8629cce31cf5428108e21427b2dee38ef6e3cfa5", "submitter": { "id": 4418, "url": "http://patchwork.ozlabs.org/api/1.2/people/4418/?format=api", "name": "Arnaud Charlet", "email": "charlet@adacore.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20170908092514.GA16335@adacore.com/mbox/", "series": [ { "id": 2152, "url": "http://patchwork.ozlabs.org/api/1.2/series/2152/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=2152", "date": "2017-09-08T09:25:14", "name": "[Ada] Implement extended version of -gnatR for record sub-components", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2152/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811418/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811418/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-return-461709-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461709-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"n4cE9DQk\"; dkim-atps=neutral", "sourceware.org; auth=none" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpX3w6Fy5z9rxm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 8 Sep 2017 19:25:32 +1000 (AEST)", "(qmail 95354 invoked by alias); 8 Sep 2017 09:25:23 -0000", "(qmail 95069 invoked by uid 89); 8 Sep 2017 09:25:22 -0000", "from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 08 Sep 2017 09:25:16 +0000", "from localhost (localhost.localdomain [127.0.0.1])\tby\n\tfiltered-rock.gnat.com (Postfix) with ESMTP id 054315619D;\n\tFri, 8 Sep 2017 05:25:15 -0400 (EDT)", "from rock.gnat.com ([127.0.0.1])\tby localhost (rock.gnat.com\n\t[127.0.0.1]) (amavisd-new, port 10024)\twith LMTP id\n\tQ45LlDuTO8mV; Fri, 8 Sep 2017 05:25:14 -0400 (EDT)", "from tron.gnat.com (tron.gnat.com\n\t[IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294])\tby rock.gnat.com\n\t(Postfix) with ESMTP id E5F6756126;\n\tFri, 8 Sep 2017 05:25:14 -0400 (EDT)", "by tron.gnat.com (Postfix, from userid 4192)\tid E24B7505;\n\tFri, 8 Sep 2017 05:25:14 -0400 (EDT)" ], "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; q=dns;\n\ts=default; b=TDT7NuDdJEu+7Qf86YV9oF0L9V/PCzR2SMzZSJ85s4xT14mt2X\n\tj9P0/nPpo4isCJFHG6ZUdIcDJkyi+QQU+oC/taadkJsQPhqAmeD75DQAajnv6707\n\t+Vy+PeFLhphLuJYL/VvK2BE1rOtV8ADks7cwROFkPxBUcnk4ceV+ZdWIs=", "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; s=\n\tdefault; bh=8uKenwkfje8Mj/MygplX8FPpjws=; b=n4cE9DQkLAJjM16QsDPo\n\ttg2N9H8EAQ3O5yTW0w5sVKMxF8Wn2uqWSR4wmJkdtZtn/o32WI3N+wwXFEbnZWr1\n\tIdlC/FfPsBgtNugHWrTu5rSJ6LoOki/fGyUyRsx61TjwPkMgt7nOglQhzKDdHG4z\n\tIguyu7QvlRmmzcnN4q+Aw0s=", "Mailing-List": "contact gcc-patches-help@gcc.gnu.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "List-Archive": "<http://gcc.gnu.org/ml/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-help@gcc.gnu.org>", "Sender": "gcc-patches-owner@gcc.gnu.org", "X-Virus-Found": "No", "X-Spam-SWARE-Status": "No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=", "X-HELO": "rock.gnat.com", "Date": "Fri, 8 Sep 2017 05:25:14 -0400", "From": "Arnaud Charlet <charlet@adacore.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "Eric Botcazou <ebotcazou@adacore.com>", "Subject": "[Ada] Implement extended version of -gnatR for record sub-components", "Message-ID": "<20170908092514.GA16335@adacore.com>", "MIME-Version": "1.0", "Content-Type": "multipart/mixed; boundary=\"G4iJoqBmSsgzjUCe\"", "Content-Disposition": "inline", "User-Agent": "Mutt/1.5.23 (2014-03-12)" }, "content": "This adds a -gnatRe variant to the -gnatR switch, which displays extended\nrepresentation information for components of records that are themselves\nrecords by recursing on the layout of sub-components.\n\nThis also makes the compiler accept -gnatR0, as documented in the User Guide.\n\nFor the following package:\n\npragma No_Component_Reordering;\n\npackage P is\n\n type Int7 is mod 2 ** 7;\n for Int7'Size use 7;\n\n type Rec1 is record\n I1 : Integer;\n I2 : Int7;\n B1 : Boolean;\n B2 : Boolean;\n end record;\n pragma Pack (Rec1);\n\n type Rec2 is record\n B : Boolean;\n C : Character;\n R1 : Rec1;\n I : Integer;\n end record;\n pragma Pack (Rec2);\n\n type Rec3 is record\n B1 : Boolean;\n B2 : Boolean;\n R2 : Rec2;\n C : Character;\n end record;\n pragma Pack (Rec3);\n\nend P;\n\nthe compiler must give the following information with -gnatRe:\n\nRepresentation information for unit P (spec)\n\nfor Rec1'Object_Size use 48;\nfor Rec1'Value_Size use 41;\nfor Rec1'Alignment use 1;\nfor Rec1 use record\n I1 at 0 range 0 .. 31;\n I2 at 4 range 0 .. 6;\n B1 at 4 range 7 .. 7;\n B2 at 5 range 0 .. 0;\nend record;\n\nfor Rec2'Object_Size use 88;\nfor Rec2'Value_Size use 82;\nfor Rec2'Alignment use 1;\nfor Rec2 use record\n B at 0 range 0 .. 0;\n C at 0 range 1 .. 8;\n R1.I1 at 1 range 1 .. 32;\n R1.I2 at 5 range 1 .. 7;\n R1.B1 at 6 range 0 .. 0;\n R1.B2 at 6 range 1 .. 1;\n I at 6 range 2 .. 33;\nend record;\n\nfor Rec3'Object_Size use 96;\nfor Rec3'Value_Size use 92;\nfor Rec3'Alignment use 1;\nfor Rec3 use record\n B1 at 0 range 0 .. 0;\n B2 at 0 range 1 .. 1;\n R2.B at 0 range 2 .. 2;\n R2.C at 0 range 3 .. 10;\n R2.R1.I1 at 1 range 3 .. 34;\n R2.R1.I2 at 5 range 3 .. 9;\n R2.R1.B1 at 6 range 2 .. 2;\n R2.R1.B2 at 6 range 3 .. 3;\n R2.I at 6 range 4 .. 35;\n C at 10 range 4 .. 11;\nend record;\n\nTested on x86_64-pc-linux-gnu, committed on trunk\n\n2017-09-08 Eric Botcazou <ebotcazou@adacore.com>\n\n\t* debug.adb (dA): Adjust comment.\n\t* gnat1drv.adb (Gnat1drv): Likewise.\n\t* opt.ads (List_Representation_Info_Extended): New variable.\n\t* repinfo.adb (List_Record_Info): Split implementation into...\n\t(Compute_Max_Length): ...this.\tRecurse on records if requested.\n\t(List_Record_Layout): Likewise.\n\t* switch-c.adb (Scan_Front_End_Switches) <'R'>: Use case\n\tstatement, accept '0' and set List_Representation_Info_Extended\n\ton 'e'.\n\t* usage.adb (Usage): Document new -gnatRe variant.", "diff": "Index: switch-c.adb\n===================================================================\n--- switch-c.adb\t(revision 251863)\n+++ switch-c.adb\t(working copy)\n@@ -6,7 +6,7 @@\n -- --\n -- B o d y --\n -- --\n--- Copyright (C) 2001-2016, Free Software Foundation, Inc. --\n+-- Copyright (C) 2001-2017, Free Software Foundation, Inc. --\n -- --\n -- GNAT is free software; you can redistribute it and/or modify it under --\n -- terms of the GNU General Public License as published by the Free Soft- --\n@@ -1143,19 +1143,24 @@\n while Ptr <= Max loop\n C := Switch_Chars (Ptr);\n \n- if C in '1' .. '3' then\n+ case C is\n+\n+ when '0' .. '3' =>\n List_Representation_Info :=\n Character'Pos (C) - Character'Pos ('0');\n \n- elsif Switch_Chars (Ptr) = 's' then\n+ when 's' =>\n List_Representation_Info_To_File := True;\n \n- elsif Switch_Chars (Ptr) = 'm' then\n+ when 'm' =>\n List_Representation_Info_Mechanisms := True;\n \n- else\n+ when 'e' =>\n+ List_Representation_Info_Extended := True;\n+\n+ when others =>\n Bad_Switch (\"-gnatR\" & Switch_Chars (Ptr .. Max));\n- end if;\n+ end case;\n \n Ptr := Ptr + 1;\n end loop;\nIndex: usage.adb\n===================================================================\n--- usage.adb\t(revision 251863)\n+++ usage.adb\t(working copy)\n@@ -392,7 +392,7 @@\n \n Write_Switch_Char (\"R?\");\n Write_Line\n- (\"List rep info (?=0/1/2/3/m for none/types/all/variable/mechanisms)\");\n+ (\"List rep info (?=0/1/2/3/e/m for none/types/all/symbolic/ext/mech)\");\n Write_Switch_Char (\"R?s\");\n Write_Line (\"List rep info to file.rep instead of standard output\");\n \nIndex: debug.adb\n===================================================================\n--- debug.adb\t(revision 251872)\n+++ debug.adb\t(working copy)\n@@ -357,7 +357,7 @@\n -- information for all internal type and object entities, as well\n -- as all user defined type and object entities including private\n -- and incomplete types. This debug switch also automatically sets\n- -- the equivalent of -gnatR3m.\n+ -- the equivalent of -gnatRm.\n \n -- dB Output debug encodings for types and variants. See Exp_Dbug for\n -- exact form of the generated output.\nIndex: gnat1drv.adb\n===================================================================\n--- gnat1drv.adb\t(revision 251869)\n+++ gnat1drv.adb\t(working copy)\n@@ -540,7 +540,7 @@\n Configurable_Run_Time_Mode := True;\n end if;\n \n- -- Set -gnatR3m mode if debug flag A set\n+ -- Set -gnatRm mode if debug flag A set\n \n if Debug_Flag_AA then\n Back_Annotate_Rep_Info := True;\nIndex: repinfo.adb\n===================================================================\n--- repinfo.adb\t(revision 251869)\n+++ repinfo.adb\t(working copy)\n@@ -854,213 +854,327 @@\n ----------------------\n \n procedure List_Record_Info (Ent : Entity_Id; Bytes_Big_Endian : Boolean) is\n- Comp : Entity_Id;\n- Cfbit : Uint;\n- Sunit : Uint;\n \n- Max_Name_Length : Natural;\n- Max_Suni_Length : Natural;\n+ procedure Compute_Max_Length\n+ (Ent : Entity_Id;\n+ Starting_Position : Uint := Uint_0;\n+ Starting_First_Bit : Uint := Uint_0;\n+ Prefix_Length : Natural := 0);\n+ -- Internal recursive procedure to compute the max length\n \n- begin\n- Blank_Line;\n- List_Type_Info (Ent);\n+ procedure List_Record_Layout\n+ (Ent : Entity_Id;\n+ Starting_Position : Uint := Uint_0;\n+ Starting_First_Bit : Uint := Uint_0;\n+ Prefix : String := \"\");\n+ -- Internal recursive procedure to display the layout\n \n- Write_Str (\"for \");\n- List_Name (Ent);\n- Write_Line (\" use record\");\n+ Max_Name_Length : Natural := 0;\n+ Max_Spos_Length : Natural := 0;\n \n- -- First loop finds out max line length and max starting position\n- -- length, for the purpose of lining things up nicely.\n+ ------------------------\n+ -- Compute_Max_Length --\n+ ------------------------\n \n- Max_Name_Length := 0;\n- Max_Suni_Length := 0;\n+ procedure Compute_Max_Length\n+ (Ent : Entity_Id;\n+ Starting_Position : Uint := Uint_0;\n+ Starting_First_Bit : Uint := Uint_0;\n+ Prefix_Length : Natural := 0)\n+ is\n+ Comp : Entity_Id;\n \n- Comp := First_Component_Or_Discriminant (Ent);\n- while Present (Comp) loop\n+ begin\n+ Comp := First_Component_Or_Discriminant (Ent);\n+ while Present (Comp) loop\n \n- -- Skip discriminant in unchecked union (since it is not there!)\n+ -- Skip discriminant in unchecked union (since it is not there!)\n \n- if Ekind (Comp) = E_Discriminant\n- and then Is_Unchecked_Union (Ent)\n- then\n- null;\n+ if Ekind (Comp) = E_Discriminant\n+ and then Is_Unchecked_Union (Ent)\n+ then\n+ goto Continue;\n+ end if;\n \n- -- All other cases\n+ -- All other cases\n \n- else\n- Get_Decoded_Name_String (Chars (Comp));\n- Max_Name_Length := Natural'Max (Max_Name_Length, Name_Len);\n+ declare\n+ Ctyp : constant Entity_Id := Underlying_Type (Etype (Comp));\n+ Bofs : constant Uint := Component_Bit_Offset (Comp);\n+ Npos : Uint;\n+ Fbit : Uint;\n+ Spos : Uint;\n+ Sbit : Uint;\n+ Name_Length : Natural;\n+ begin\n+ Get_Decoded_Name_String (Chars (Comp));\n+ Name_Length := Prefix_Length + Name_Len;\n \n- Cfbit := Component_Bit_Offset (Comp);\n+ if Rep_Not_Constant (Bofs) then\n \n- if Rep_Not_Constant (Cfbit) then\n+ -- If the record is not packed, then we know that all fields\n+ -- whose position is not specified have starting normalized\n+ -- bit position of zero.\n \n- -- If the record is not packed, then we know that all fields\n- -- whose position is not specified have a starting normalized\n- -- bit position of zero.\n+ if Unknown_Normalized_First_Bit (Comp)\n+ and then not Is_Packed (Ent)\n+ then\n+ Set_Normalized_First_Bit (Comp, Uint_0);\n+ end if;\n \n- if Unknown_Normalized_First_Bit (Comp)\n- and then not Is_Packed (Ent)\n- then\n- Set_Normalized_First_Bit (Comp, Uint_0);\n- end if;\n+ UI_Image_Length := 2; -- For \"??\" marker\n+ else\n+ Npos := Bofs / SSU;\n+ Fbit := Bofs mod SSU;\n \n- UI_Image_Length := 2; -- For \"??\" marker\n- else\n- -- Complete annotation in case not done\n+ -- Complete annotation in case not done\n \n- if Unknown_Normalized_First_Bit (Comp) then\n- Set_Normalized_Position (Comp, Cfbit / SSU);\n- Set_Normalized_First_Bit (Comp, Cfbit mod SSU);\n+ if Unknown_Normalized_First_Bit (Comp) then\n+ Set_Normalized_Position (Comp, Npos);\n+ Set_Normalized_First_Bit (Comp, Fbit);\n+ end if;\n+\n+ Spos := Starting_Position + Npos;\n+ Sbit := Starting_First_Bit + Fbit;\n+ if Sbit >= SSU then\n+ Spos := Spos + 1;\n+ Sbit := Sbit - SSU;\n+ end if;\n+\n+ -- If extended information is requested, recurse fully into\n+ -- record components, i.e. skip the outer level.\n+\n+ if List_Representation_Info_Extended\n+ and then Is_Record_Type (Ctyp)\n+ then\n+ Compute_Max_Length (Ctyp, Spos, Sbit, Name_Length + 1);\n+ goto Continue;\n+ end if;\n+\n+ UI_Image (Spos);\n end if;\n \n- Sunit := Cfbit / SSU;\n- UI_Image (Sunit);\n- end if;\n+ Max_Name_Length := Natural'Max (Max_Name_Length, Name_Length);\n+ Max_Spos_Length :=\n+ Natural'Max (Max_Spos_Length, UI_Image_Length);\n+ end;\n \n- Max_Suni_Length := Natural'Max (Max_Suni_Length, UI_Image_Length);\n- end if;\n+ <<Continue>>\n+ Next_Component_Or_Discriminant (Comp);\n+ end loop;\n+ end Compute_Max_Length;\n \n- Next_Component_Or_Discriminant (Comp);\n- end loop;\n+ ------------------------\n+ -- List_Record_Layout --\n+ ------------------------\n \n- -- Second loop does actual output based on those values\n+ procedure List_Record_Layout\n+ (Ent : Entity_Id;\n+ Starting_Position : Uint := Uint_0;\n+ Starting_First_Bit : Uint := Uint_0;\n+ Prefix : String := \"\")\n+ is\n+ Comp : Entity_Id;\n \n- Comp := First_Component_Or_Discriminant (Ent);\n- while Present (Comp) loop\n+ begin\n+ Comp := First_Component_Or_Discriminant (Ent);\n+ while Present (Comp) loop\n \n- -- Skip discriminant in unchecked union (since it is not there!)\n+ -- Skip discriminant in unchecked union (since it is not there!)\n \n- if Ekind (Comp) = E_Discriminant\n- and then Is_Unchecked_Union (Ent)\n- then\n- goto Continue;\n- end if;\n+ if Ekind (Comp) = E_Discriminant\n+ and then Is_Unchecked_Union (Ent)\n+ then\n+ goto Continue;\n+ end if;\n \n- -- All other cases\n+ -- All other cases\n \n- declare\n- Esiz : constant Uint := Esize (Comp);\n- Bofs : constant Uint := Component_Bit_Offset (Comp);\n- Npos : constant Uint := Normalized_Position (Comp);\n- Fbit : constant Uint := Normalized_First_Bit (Comp);\n- Lbit : Uint;\n+ declare\n+ Ctyp : constant Entity_Id := Underlying_Type (Etype (Comp));\n+ Esiz : constant Uint := Esize (Comp);\n+ Bofs : constant Uint := Component_Bit_Offset (Comp);\n+ Npos : constant Uint := Normalized_Position (Comp);\n+ Fbit : constant Uint := Normalized_First_Bit (Comp);\n+ Spos : Uint;\n+ Sbit : Uint;\n+ Lbit : Uint;\n \n- begin\n- Write_Str (\" \");\n- Get_Decoded_Name_String (Chars (Comp));\n- Set_Casing (Unit_Casing);\n- Write_Str (Name_Buffer (1 .. Name_Len));\n+ begin\n+ Get_Decoded_Name_String (Chars (Comp));\n+ Set_Casing (Unit_Casing);\n \n- for J in 1 .. Max_Name_Length - Name_Len loop\n- Write_Char (' ');\n- end loop;\n+ -- If extended information is requested, recurse fully into\n+ -- record components, i.e. skip the outer level.\n \n- Write_Str (\" at \");\n+ if List_Representation_Info_Extended\n+ and then Is_Record_Type (Ctyp)\n+ and then Known_Static_Normalized_Position (Comp)\n+ and then Known_Static_Normalized_First_Bit (Comp)\n+ then\n+ Spos := Starting_Position + Npos;\n+ Sbit := Starting_First_Bit + Fbit;\n+ if Sbit >= SSU then\n+ Spos := Spos + 1;\n+ Sbit := Sbit - SSU;\n+ end if;\n+ List_Record_Layout (Ctyp,\n+ Spos, Sbit, Prefix & Name_Buffer (1 .. Name_Len) & \".\");\n+ goto Continue;\n+ end if;\n \n- if Known_Static_Normalized_Position (Comp) then\n- UI_Image (Npos);\n- Spaces (Max_Suni_Length - UI_Image_Length);\n- Write_Str (UI_Image_Buffer (1 .. UI_Image_Length));\n+ Write_Str (\" \");\n+ Write_Str (Prefix);\n+ Write_Str (Name_Buffer (1 .. Name_Len));\n \n- elsif Known_Component_Bit_Offset (Comp)\n- and then List_Representation_Info = 3\n- then\n- Spaces (Max_Suni_Length - 2);\n- Write_Str (\"bit offset\");\n- Write_Val (Bofs, Paren => True);\n- Write_Str (\" size in bits = \");\n- Write_Val (Esiz, Paren => True);\n- Write_Eol;\n- goto Continue;\n+ for J in 1 .. Max_Name_Length - Prefix'Length - Name_Len loop\n+ Write_Char (' ');\n+ end loop;\n \n- elsif Known_Normalized_Position (Comp)\n- and then List_Representation_Info = 3\n- then\n- Spaces (Max_Suni_Length - 2);\n- Write_Val (Npos);\n+ Write_Str (\" at \");\n \n- else\n- -- For the packed case, we don't know the bit positions if we\n- -- don't know the starting position.\n+ if Known_Static_Normalized_Position (Comp) then\n+ Spos := Starting_Position + Npos;\n+ Sbit := Starting_First_Bit + Fbit;\n+ if Sbit >= SSU then\n+ Spos := Spos + 1;\n+ end if;\n+ UI_Image (Spos);\n+ Spaces (Max_Spos_Length - UI_Image_Length);\n+ Write_Str (UI_Image_Buffer (1 .. UI_Image_Length));\n \n- if Is_Packed (Ent) then\n- Write_Line (\"?? range ? .. ??;\");\n+ elsif Known_Component_Bit_Offset (Comp)\n+ and then List_Representation_Info = 3\n+ then\n+ Spaces (Max_Spos_Length - 2);\n+ Write_Str (\"bit offset\");\n+ if Starting_Position /= Uint_0\n+ or else Starting_First_Bit /= Uint_0\n+ then\n+ Write_Char (' ');\n+ UI_Write (Starting_Position * SSU + Starting_First_Bit);\n+ Write_Str (\" +\");\n+ end if;\n+ Write_Val (Bofs, Paren => True);\n+ Write_Str (\" size in bits = \");\n+ Write_Val (Esiz, Paren => True);\n+ Write_Eol;\n goto Continue;\n \n- -- Otherwise we can continue\n+ elsif Known_Normalized_Position (Comp)\n+ and then List_Representation_Info = 3\n+ then\n+ Spaces (Max_Spos_Length - 2);\n+ if Starting_Position /= Uint_0 then\n+ Write_Char (' ');\n+ UI_Write (Starting_Position);\n+ Write_Str (\" +\");\n+ end if;\n+ Write_Val (Npos);\n \n else\n- Write_Str (\"??\");\n- end if;\n- end if;\n+ -- For the packed case, we don't know the bit positions if\n+ -- we don't know the starting position.\n \n- Write_Str (\" range \");\n- UI_Write (Fbit);\n- Write_Str (\" .. \");\n+ if Is_Packed (Ent) then\n+ Write_Line (\"?? range ? .. ??;\");\n+ goto Continue;\n \n- -- Allowing Uint_0 here is an annoying special case. Really this\n- -- should be a fine Esize value but currently it means unknown,\n- -- except that we know after gigi has back annotated that a size\n- -- of zero is real, since otherwise gigi back annotates using\n- -- No_Uint as the value to indicate unknown).\n+ -- Otherwise we can continue\n \n- if (Esize (Comp) = Uint_0 or else Known_Static_Esize (Comp))\n- and then Known_Static_Normalized_First_Bit (Comp)\n- then\n- Lbit := Fbit + Esiz - 1;\n+ else\n+ Write_Str (\"??\");\n+ end if;\n+ end if;\n \n- if Lbit < 10 then\n- Write_Char (' ');\n+ Write_Str (\" range \");\n+ Sbit := Starting_First_Bit + Fbit;\n+ if Sbit >= SSU then\n+ Sbit := Sbit - SSU;\n end if;\n+ UI_Write (Sbit);\n+ Write_Str (\" .. \");\n \n- UI_Write (Lbit);\n+ -- Allowing Uint_0 here is an annoying special case. Really\n+ -- this should be a fine Esize value but currently it means\n+ -- unknown, except that we know after gigi has back annotated\n+ -- that a size of zero is real, since otherwise gigi back\n+ -- annotates using No_Uint as the value to indicate unknown).\n \n- -- The test for Esize (Comp) not Uint_0 here is an annoying\n- -- special case. Officially a value of zero for Esize means\n- -- unknown, but here we use the fact that we know that gigi\n- -- annotates Esize with No_Uint, not Uint_0. Really everyone\n- -- should use No_Uint???\n+ if (Esize (Comp) = Uint_0 or else Known_Static_Esize (Comp))\n+ and then Known_Static_Normalized_First_Bit (Comp)\n+ then\n+ Lbit := Sbit + Esiz - 1;\n \n- elsif List_Representation_Info < 3\n- or else (Esize (Comp) /= Uint_0 and then Unknown_Esize (Comp))\n- then\n- Write_Str (\"??\");\n+ if Lbit < 10 then\n+ Write_Char (' ');\n+ end if;\n \n- -- List_Representation >= 3 and Known_Esize (Comp)\n+ UI_Write (Lbit);\n \n- else\n- Write_Val (Esiz, Paren => True);\n+ -- The test for Esize (Comp) not Uint_0 here is an annoying\n+ -- special case. Officially a value of zero for Esize means\n+ -- unknown, but here we use the fact that we know that gigi\n+ -- annotates Esize with No_Uint, not Uint_0. Really everyone\n+ -- should use No_Uint???\n \n- -- If in front end layout mode, then dynamic size is stored\n- -- in storage units, so renormalize for output\n+ elsif List_Representation_Info < 3\n+ or else (Esize (Comp) /= Uint_0 and then Unknown_Esize (Comp))\n+ then\n+ Write_Str (\"??\");\n \n- if not Back_End_Layout then\n- Write_Str (\" * \");\n- Write_Int (SSU);\n- end if;\n+ -- List_Representation >= 3 and Known_Esize (Comp)\n \n- -- Add appropriate first bit offset\n+ else\n+ Write_Val (Esiz, Paren => True);\n \n- if Fbit = 0 then\n- Write_Str (\" - 1\");\n+ -- If in front end layout mode, then dynamic size is stored\n+ -- in storage units, so renormalize for output\n \n- elsif Fbit = 1 then\n- null;\n+ if not Back_End_Layout then\n+ Write_Str (\" * \");\n+ Write_Int (SSU);\n+ end if;\n \n- else\n- Write_Str (\" + \");\n- Write_Int (UI_To_Int (Fbit) - 1);\n+ -- Add appropriate first bit offset\n+\n+ if Sbit = 0 then\n+ Write_Str (\" - 1\");\n+\n+ elsif Sbit = 1 then\n+ null;\n+\n+ else\n+ Write_Str (\" + \");\n+ Write_Int (UI_To_Int (Sbit) - 1);\n+ end if;\n end if;\n- end if;\n \n- Write_Line (\";\");\n- end;\n+ Write_Line (\";\");\n+ end;\n \n- <<Continue>>\n- Next_Component_Or_Discriminant (Comp);\n- end loop;\n+ <<Continue>>\n+ Next_Component_Or_Discriminant (Comp);\n+ end loop;\n+ end List_Record_Layout;\n \n+ begin\n+ Blank_Line;\n+ List_Type_Info (Ent);\n+\n+ Write_Str (\"for \");\n+ List_Name (Ent);\n+ Write_Line (\" use record\");\n+\n+ -- First find out max line length and max starting position\n+ -- length, for the purpose of lining things up nicely.\n+\n+ Compute_Max_Length (Ent);\n+\n+ -- Then do actual output based on those values\n+\n+ List_Record_Layout (Ent);\n+\n Write_Line (\"end record;\");\n \n List_Scalar_Storage_Order (Ent, Bytes_Big_Endian);\nIndex: opt.ads\n===================================================================\n--- opt.ads\t(revision 251863)\n+++ opt.ads\t(working copy)\n@@ -982,6 +982,11 @@\n -- Set true by -gnatRm switch. Causes information on mechanisms to be\n -- included in the representation output information.\n \n+ List_Representation_Info_Extended : Boolean := False;\n+ -- GNAT\n+ -- Set true by -gnatRe switch. Causes extended information for record types\n+ -- to be included in the representation output information.\n+\n List_Preprocessing_Symbols : Boolean := False;\n -- GNAT, GNATPREP\n -- Set to True if symbols for preprocessing a source are to be listed\n", "prefixes": [ "Ada" ] }