Your message dated Sun, 04 Mar 2018 15:05:43 +0000
with message-id <[email protected]>
and subject line Bug#861616: fixed in gnat-gps 17.0.2017-1~exp1
has caused the Debian Bug report #861616,
regarding gnat-gps: Inaccuracies in documentation generated by GNATdoc
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
861616: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=861616
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: gnat-gps
Version: 6.1.1-1
Severity: normal
Tags: patch upstream

Dear Maintainer,

While playing with GNATdoc, I identified some inaccuracies in the
generated HTML documentation for a simple Ada code:

1. The "not overriding" indicators appear as "overriding" indicators.

2. The line numbers shown for the subprogram declarations are wrong (one
   unit too high) if there is an "overriding" or a "not overriding"
   indicator on the previous line.

3. The rendering of the declaration of subtypes erroneously includes
   preceding lines of code.

I managed to write a patch for package gnat-gps so that GNATdoc generates
an accurate documentation (for my simple Ada code at least).

The patch affects two files:
- gnatdoc/src/gnatdoc-frontend.adb
- gnatdoc/src/gnatdoc-backend-html.adb

I'm aware that the modification I made to
gnatdoc/src/gnatdoc-backend-html.adb to fix the wrong line numbers issue
is ugly but I believe it works well enough. Someone more comfortable
with the internal structures of GNATdoc could no doubt do better.

My simple Ada code, the gnat-gps patch and the generated documentation
before and after patching are available on this GitHub repository:

https://github.com/thierr26/gnatdoc_test



-- System Information:
Debian Release: 9.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64
 (x86_64)

Kernel: Linux 4.9.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages gnat-gps depends on:
ii  gnat-gps-common                  6.1.1-1
ii  gprbuild                         2015-6
ii  libc6                            2.24-10
ii  libcairo2                        1.14.8-1
ii  libgcc1                          1:6.3.0-14
ii  libgdk-pixbuf2.0-0               2.36.5-2
ii  libglib2.0-0                     2.50.3-2
ii  libgnat-6                        6.3.0-14
ii  libgnatcoll-gtk1.7               1.7gpl2015-2+b3
ii  libgnatcoll-iconv1.7             1.7gpl2015-2+b3
ii  libgnatcoll-python1.7            1.7gpl2015-2+b3
ii  libgnatcoll-sqlite-bin           1.7gpl2015-2+b3
ii  libgnatcoll-sqlite1.7            1.7gpl2015-2+b3
ii  libgnatcoll1.7                   1.7gpl2015-2+b3
ii  libgnatprj6                      6.3.0-14
ii  libgnatvsn6                      6.3.0-14
ii  libgtk-3-0                       3.22.12-1
ii  libgtkada3.8.3                   3.8.3-1+b3
ii  libpango-1.0-0                   1.40.5-1
ii  libtemplates-parser11.10.1       11.10-4
ii  libxmlada-dom4.5.2015            4.5.2015-8+b2
ii  libxmlada-input-sources4.5.2015  4.5.2015-8+b2
ii  libxmlada-sax4.5.2015            4.5.2015-8+b2
ii  libxmlada-unicode4.5.2015        4.5.2015-8+b2
ii  python-gi                        3.22.0-2

Versions of packages gnat-gps recommends:
ii  gdb-minimal   7.12-6
ii  gnat          6.1
ii  gnat-gps-doc  6.1.1-1
ii  python-jedi   0.10.0~git1+f05c071-1
ii  python-pep8   1.7.0-4

gnat-gps suggests no packages.

-- no debconf information
--- a/gnatdoc/src/gnatdoc-backend-html.adb
+++ b/gnatdoc/src/gnatdoc-backend-html.adb
@@ -938,12 +938,45 @@
                declare
                   Buffer : aliased String := To_String (Get_Src (E));
                   Code   : JSON_Value;
+                  Line : Positive := LL.Get_Location (E).Line;
+                  Start_Col : Positive;
 
                begin
+                  if Buffer'Length > 0
+                    and then (Get_Kind (E) = E_Procedure
+                    or else Get_Kind (E) = E_Function
+                    or else Get_Kind (E) = E_Entry) then
+                     Start_Col := Buffer'First;
+                     while (Buffer (Start_Col) = ' '
+                       or else Buffer (Start_Col) = ASCII.HT)
+                       and then Start_Col < Buffer'Last loop
+                        Start_Col := Start_Col + 1;
+                     end loop;
+                     if Buffer (Start_Col) /= ' '
+                       and then Buffer (Start_Col) /= ASCII.HT
+                       and then Buffer'Last >= Start_Col + 11
+                       and then (Buffer (Start_Col + 10) = ASCII.LF
+                       or else Buffer (Start_Col + 11) = ASCII.LF) then
+                        if Buffer (Start_Col .. Start_Col + 9)
+                          = "overriding" then
+                           Line := Line - 1;
+                        end if;
+                     end if;
+                     if Buffer (Start_Col) /= ' '
+                       and then Buffer (Start_Col) /= ASCII.HT
+                       and then Buffer'Last >= Start_Col + 15
+                       and then (Buffer (Start_Col + 14) = ASCII.LF
+                       or else Buffer (Start_Col + 15) = ASCII.LF) then
+                        if Buffer (Start_Col .. Start_Col + 13)
+                          = "not overriding" then
+                           Line := Line - 1;
+                        end if;
+                     end if;
+                  end if;
                   Self.Print_Source_Code
                     (Tree.File,
                      Buffer'Unchecked_Access,
-                     LL.Get_Location (E).Line,
+                     Line,
                      Printer,
                      Code);
                   Prepend (Description, Code);
--- a/gnatdoc/src/gnatdoc-frontend.adb
+++ b/gnatdoc/src/gnatdoc-frontend.adb
@@ -71,6 +71,7 @@
       Tok_Is,
       Tok_Limited,
       Tok_New,
+      Tok_Not,
       Tok_Null,
       Tok_Overriding,
       Tok_Others,
@@ -1287,6 +1288,8 @@
          Cursor                 : Extended_Cursor.Extended_Cursor;
          Last_Idx               : Natural := 0;
          Par_Count              : Natural := 0;
+         Prev_Prev_Token        : Tokens := Tok_Unknown;
+         Prev_Prev_Token_Loc    : Source_Location;
          Prev_Token             : Tokens := Tok_Unknown;
          Prev_Token_Loc         : Source_Location;
          Token                  : Tokens := Tok_Unknown;
@@ -1340,12 +1343,14 @@
          procedure Clear_Parser_State is
             No_Source_Location : constant Source_Location := (0, 0, 0);
          begin
-            Last_Idx       := 0;
-            Par_Count      := 0;
-            Prev_Token     := Tok_Unknown;
-            Prev_Token_Loc := No_Source_Location;
-            Token          := Tok_Unknown;
-            Token_Loc      := No_Source_Location;
+            Last_Idx            := 0;
+            Par_Count           := 0;
+            Prev_Prev_Token     := Tok_Unknown;
+            Prev_Prev_Token_Loc := No_Source_Location;
+            Prev_Token          := Tok_Unknown;
+            Prev_Token_Loc      := No_Source_Location;
+            Token               := Tok_Unknown;
+            Token_Loc           := No_Source_Location;
 
             Nested_Variants_Count  := 0;
             In_Compilation_Unit    := False;
@@ -2982,7 +2987,8 @@
                         end if;
                      end;
 
-                  when Tok_Type =>
+                  when Tok_Type |
+                       Tok_Subtype =>
                      if Prev_Token = Tok_Task
                        or else Prev_Token = Tok_Protected
                      then
@@ -3002,8 +3008,13 @@
                         Clear_Src;
 
                         if Prev_Token = Tok_Overriding then
-                           Append_Src
-                             ("overriding", Prev_Token_Loc.Column);
+                           if Prev_Prev_Token = Tok_Not then
+                              Append_Src
+                                ("not overriding", Prev_Prev_Token_Loc.Column);
+                           else
+                              Append_Src
+                                ("overriding", Prev_Token_Loc.Column);
+                           end if;
 
                            if Prev_Token_Loc.Line = Sloc_Start.Line then
                               Append_Src (" " & S);
@@ -3102,6 +3113,8 @@
                procedure Update_Prev_Known_Token is
                begin
                   if Token /= Tok_Unknown then
+                     Prev_Prev_Token := Prev_Token;
+                     Prev_Prev_Token_Loc := Prev_Token_Loc;
                      Prev_Token := Token;
                      Prev_Token_Loc := Token_Loc;
                   end if;
@@ -4242,6 +4255,8 @@
                procedure Update_Prev_Known_Token is
                begin
                   if Token /= Tok_Unknown then
+                     Prev_Prev_Token := Prev_Token;
+                     Prev_Prev_Token_Loc := Prev_Token_Loc;
                      Prev_Token := Token;
                      Prev_Token_Loc := Token_Loc;
                   end if;

--- End Message ---
--- Begin Message ---
Source: gnat-gps
Source-Version: 17.0.2017-1~exp1

We believe that the bug you reported is fixed in the latest version of
gnat-gps, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Nicolas Boulenguez <[email protected]> (supplier of updated gnat-gps package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sun, 04 Mar 2018 00:05:32 +0100
Source: gnat-gps
Binary: gnat-gps gnat-gps-doc gnat-gps-common
Architecture: all amd64 source
Version: 17.0.2017-1~exp1
Distribution: experimental
Urgency: medium
Maintainer: Ludovic Brenta <[email protected]>
Changed-By: Nicolas Boulenguez <[email protected]>
Closes: 861616
Description: 
 gnat-gps-common - integrated development environment for C and Ada (common 
files)
 gnat-gps-doc - integrated development environment for C and Ada (documentation)
 gnat-gps   - integrated development environment for C and Ada
Changes:
 gnat-gps (17.0.2017-1~exp1) experimental; urgency=medium
 .
   [Nicolas Boulenguez]
   * New upstream release GPL-2017.
     Drop packaging for gnatspark executable.
     Regenerate database Ada sources. Build-Depend: libgnatcoll-sqlite-bin.
     Package new release_notes_17 documentation.
     Disable libadalang support, dependency is not packaged.
   * Re-enable clang support, seems to link correctly now. Update to 3.8.
   * Build-Depends: drop obsolete version restriction on dpkg-dev.
   * Debheper 11. Simplifies installation of documentation.
   * gtk3-incompatibility.diff: goes with libgtkada17.0-dev, fixing
     gtkada with recent gtk3.
   * Build-Depend: python3-sphinx instead of deprecated python2 version.
   * Fix many incompatibilities with python3. Build-Depend: python*-six.
     Gather all python3-related fixes in a single diff to ease rebasing.
   * Remove trailing whitespaces in this changelog.
   * Tell lintian that welcome.html does not need doc-base registration.
   * Remove __pycache__ directories after removing .pyc contents.
   * Remove execution rights for some python modules.
   * Standards-Version: 4.1.3. No changes.
   * Allow gnat-gps-doc to satisfy Multi-Arch foreign dependencies.
 .
   [Thierry Rascle <[email protected]>]
   * gnatdoc.diff closes: #861616.
Checksums-Sha1: 
 af230343eb6eb37b8c57ba8c9393ad955d81bf86 2772 gnat-gps_17.0.2017-1~exp1.dsc
 d9d8bc82fbb01cd3b7a11480c7e829d97effaa49 13161632 
gnat-gps_17.0.2017.orig.tar.xz
 bdeff28fc8909cefb5d78aac848342309a1199ac 56452 
gnat-gps_17.0.2017-1~exp1.debian.tar.xz
 65a9731821dd2510ff2d189fa652d54f3c693391 2799188 
gnat-gps-common_17.0.2017-1~exp1_all.deb
 7a259cb84693b63cc6b9bc40c9867776d9472952 53803560 
gnat-gps-dbgsym_17.0.2017-1~exp1_amd64.deb
 0bf760ec1c0df2423c79b4cc460dd513ef98fd48 14321488 
gnat-gps-doc_17.0.2017-1~exp1_all.deb
 66e9bfaa83036217f5b23058f14a93055b10b32c 18078 
gnat-gps_17.0.2017-1~exp1_amd64.buildinfo
 656a06b14122613298907fdad973d2311a010b52 15642732 
gnat-gps_17.0.2017-1~exp1_amd64.deb
Checksums-Sha256: 
 76707c4a34641657a727c96a1273e24fc9c6724f089b346e8f8a24a17ccff1ed 2772 
gnat-gps_17.0.2017-1~exp1.dsc
 67a9bf02c088fde824fe088f6872209fb4d0a9eeb0cf4ef62025ecc5eeeab32e 13161632 
gnat-gps_17.0.2017.orig.tar.xz
 994579c9aa8c5fd2f56da6cab0ee9e69950f7573f7c9d6ebde5f91ad18f83e74 56452 
gnat-gps_17.0.2017-1~exp1.debian.tar.xz
 7d3834d2853fb3070e29e93aa74552c43f3dfc07c5b5732ebb97a6782c5310e3 2799188 
gnat-gps-common_17.0.2017-1~exp1_all.deb
 dd64730f94e69d0a22d3c69dda885943596f779ce6600dd163ae764567f33cfd 53803560 
gnat-gps-dbgsym_17.0.2017-1~exp1_amd64.deb
 680516b1cef5419d0a43c3be58a7be8be0c3053d318df115246e7c5b64a2a872 14321488 
gnat-gps-doc_17.0.2017-1~exp1_all.deb
 3e3e2c2ed8f4989acda5ec09e223f50559d6f1e6b006f1824e9731a043d02f0a 18078 
gnat-gps_17.0.2017-1~exp1_amd64.buildinfo
 aead069f87d0f539107a450f9f6c9e88f5cde279070fffe2c8acd01600ceaffe 15642732 
gnat-gps_17.0.2017-1~exp1_amd64.deb
Files: 
 37e9176b3b45a5fe555c29d21b83d279 2772 devel optional 
gnat-gps_17.0.2017-1~exp1.dsc
 4214332a9c31315455cac00ae354a19c 13161632 devel optional 
gnat-gps_17.0.2017.orig.tar.xz
 3e60abe3e10c2a67e5bc0aa74bfbdc46 56452 devel optional 
gnat-gps_17.0.2017-1~exp1.debian.tar.xz
 03264a320b421b32a5545c7e11fa6d2c 2799188 devel optional 
gnat-gps-common_17.0.2017-1~exp1_all.deb
 33427185876421dc58d9a2d42806489d 53803560 debug optional 
gnat-gps-dbgsym_17.0.2017-1~exp1_amd64.deb
 7f62c5bddd58ce84cc6a6f7b89451ed8 14321488 doc optional 
gnat-gps-doc_17.0.2017-1~exp1_all.deb
 a12b480baf7cb04971ecc93f694f6bfe 18078 devel optional 
gnat-gps_17.0.2017-1~exp1_amd64.buildinfo
 a2644a07235772c170c63caf50d937e4 15642732 devel optional 
gnat-gps_17.0.2017-1~exp1_amd64.deb

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCAAxFiEEYtlNMqmXIhEvWffytSqc9EkN/I0FAlqb9vQTHG5pY29sYXNA
ZGViaWFuLm9yZwAKCRC1Kpz0SQ38jVEbD/0Rr4ge1WHuWz0NfgFTug6XY/dUx1cn
mhgsEFJ0ldtILk9V6sRlKQXNqi+HqciWV/6kfxnj9zulyku/DQmK1NhwifMo4yLD
AtvJf0A1GH/4bXcR13JxRChA3NVs0uotJuRwM3DW58CGdYlJK+dJyrCaxZOTZBCB
lI/QLqlGFxsHewgjLZySi0Dbrq4ryvJTB40d+A/XAcuubK5/cGfrmp2Sh6FhpFCg
FLKEyMVtm4KfT165FOkWprZwn8yA/6mF1RQYCmhSKr2caMSHvITO32kpL8P5KRnd
Cj0mAQW2AjrJ9akyo3zwkhZMoKCTMdNs7EX0V3Iizhd1E0TS+6StugU3ep56+iCt
KthfeaOXwwpprgjKJmDZ+ilhLPvPgwQ3dPKx3e/FsFHNuWAjwDgdkCNv9Qe8bnlq
F9LIg0/y0tnJE6XK2mfRoKpgLvAaiopv23c0fUHn8sUaxQefUCE2UETt99YeZjVH
SjeCkxpMpvF2POFLAtGQAV8+oqNghHixYdcP7tQIVLc6W2E8tMIW46ATB4bThGIf
Wz9J/qowMXj/Eglnj762IGm1pWiPH81TYCMEMLWGKrTJYplSD3CeTnaTp1yp9w0Y
OWK03fGsnRvoYiUGAx5Op1yoogmWCGhF/RVrrWPyZClyy6XPAhJADiZyhhOnxEWw
h2x976qEe1f3uw==
=CUk3
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to