AdaCore / libadalang-tools

Libadalang-based tools
GNU General Public License v3.0
16 stars 13 forks source link

gnatpp: Pretty Printer formater incorrectly idents commenting blocks #3

Open NCommander opened 4 years ago

NCommander commented 4 years ago

I was forwarded here by @pmderodat relating to an issue I ran into with GNAT GPL Community 2019 relating to pretty printing. I haven't been able to simply the test case but the full source code is available here: https://github.com/dnscatcher/DNSCatcher

The issue is consistent in many of the files in src/dnscatcher/dns/processor/rdata/*.ads, and manifests like this

   -- Converts a RR record to logicial representation
   --
   -- @value This
   -- Class object
   --
   -- @value DNS_Header
   -- DNS Packet Header
   --
   -- @value Parsed_RR
   -- Any parsed Resource Record from Processor.Packet
   --
   procedure From_Parsed_RR
     (This       : in out Parsed_Unknown_RData;
      DNS_Header :        DNS_Packet_Header;
      Parsed_RR  :        Parsed_DNS_Resource_Record);

      -- Represents RData as a String for debug logging
      --
      -- @value This
      -- Class object
      --
      -- @returns
      -- String saying "UNKNOWN"
      --
   function RData_To_String
     (This : in Parsed_Unknown_RData)
      return String;

   -- Represents the resource record packet as a whole as a string
   --
   -- @value This
   -- Class object
   --
   -- @returns
   --  String that states "UNKNOWN"
   --
   function Print_Packet
     (This : in Parsed_Unknown_RData)
      return String;

That single block keeps being indented in all the subclasses of RData in this package. The pretty printer settings are as follows (from compiler_settings.gpr)

   package Pretty_Printer is
      for Default_Switches ("ada") use (
                                        "-w",
                                        "-rnb",
                                        "-c4",
                                        "--call_threshold=1",
                                        "--par_threshold=1",
                                        "--separate-stmt-name",
                                        "--vertical-enum-types",
                                        "--vertical-array-types",
                                        "--vertical-case-alternatives",
                                        "--separate-loop-then");
   end Pretty_Printer;

I've tried a few other settings with no avail, so any insight or workarounds would be greatly appreciated.

Fabien-Chouteau commented 1 year ago

Sorry this was closed by mistake.