chiark / gitweb /
documentation/doxygen: this bug with includes happens only on < 1.8.20.
authorVladimír Vondruš <mosra@centrum.cz>
Sat, 14 Sep 2024 17:07:03 +0000 (19:07 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Sat, 14 Sep 2024 17:07:03 +0000 (19:07 +0200)
documentation/test_doxygen/compound_includes/Second.h
documentation/test_doxygen/compound_includes/structSpreadClass-1818.html [new file with mode: 0644]
documentation/test_doxygen/compound_includes/structSpreadClass.html
documentation/test_doxygen/compound_includes_disabled/structSpreadClass.html
documentation/test_doxygen/compound_includes_undocumented_files/Second.h
documentation/test_doxygen/test_compound.py

index 19253104b61007903318002225d01e9733588215..19e646fd7c9096ed009ba87ac846220a4be9eb04 100644 (file)
@@ -52,15 +52,16 @@ void relatedFunc();
 /**
 @brief A class forward-declared in one file but defined in another
 
-Because Doxygen is stupid, it reports the class to be defined in First.h even
-though there's just a fwdecl. Happens only if the class is a template,
-non-templated class would have its location reported correctly.
+Doxygen < 1.8.20 is stupid and reports the class to be defined in First.h even
+though there's just a fwdecl. Happens only if the class is a template, a
+non-templated class would have its location reported correctly.
 
-If includes are enabled, members should have Second.h listed as their include,
-but if they are disabled, brief-only members shouldn't have detailed sections
-at all.
+With Doxygen < 1.8.20, if includes are enabled, members should have Second.h
+listed as their include, but if they are disabled, brief-only members shouldn't
+have detailed sections at all. With 1.8.20+, there should be just one (correct)
+include for the whole class.
 */
 template<class T> struct SpreadClass {
-    /** @brief A function with (detailed) include information but no details if includes are disabled */
+    /** @brief A function with (detailed) include information on < 1.8.20 but no details if includes are disabled or on 1.8.20+ */
     void foo();
 };
diff --git a/documentation/test_doxygen/compound_includes/structSpreadClass-1818.html b/documentation/test_doxygen/compound_includes/structSpreadClass-1818.html
new file mode 100644 (file)
index 0000000..b66c90f
--- /dev/null
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>SpreadClass struct | My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          <div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="First_8h.html">&lt;First.h&gt;</a></div>
+          <div class="m-doc-template">template&lt;class T&gt;</div>
+          SpreadClass <span class="m-thin">struct</span>
+        </h1>
+        <p>A class forward-declared in one file but defined in another.</p>
+        <nav class="m-block m-default">
+          <h3>Contents</h3>
+          <ul>
+            <li>
+              Reference
+              <ul>
+                <li><a href="#pub-methods">Public functions</a></li>
+              </ul>
+            </li>
+          </ul>
+        </nav>
+<p>Doxygen &lt; 1.8.20 is stupid and reports the class to be defined in First.h even though there&#x27;s just a fwdecl. Happens only if the class is a template, a non-templated class would have its location reported correctly.</p><p>With Doxygen &lt; 1.8.20, if includes are enabled, members should have Second.h listed as their include, but if they are disabled, brief-only members shouldn&#x27;t have detailed sections at all. With 1.8.20+, there should be just one (correct) include for the whole class.</p>
+        <section id="pub-methods">
+          <h2><a href="#pub-methods">Public functions</a></h2>
+          <dl class="m-doc">
+            <dt>
+              <span class="m-doc-wrap-bumper">void <a href="#a0537e4d57c78086a29ab6143da0d9a21" class="m-doc">foo</a>(</span><span class="m-doc-wrap">)</span>
+            </dt>
+            <dd>A function with (detailed) include information on &lt; 1.8.20 but no details if includes are disabled or on 1.8.20+.</dd>
+          </dl>
+        </section>
+        <section>
+          <h2>Function documentation</h2>
+          <section class="m-doc-details" id="a0537e4d57c78086a29ab6143da0d9a21"><div>
+            <h3>
+              <div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="Second_8h.html">&lt;Second.h&gt;</a></div>
+              <div class="m-doc-template">
+                template&lt;class T&gt;
+              </div>
+              <span class="m-doc-wrap-bumper">void SpreadClass&lt;T&gt;::<wbr /></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#a0537e4d57c78086a29ab6143da0d9a21" class="m-doc-self">foo</a>(</span><span class="m-doc-wrap">)</span></span>
+            </h3>
+            <p>A function with (detailed) include information on &lt; 1.8.20 but no details if includes are disabled or on 1.8.20+.</p>
+          </div></section>
+        </section>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 8b41f78f93daebd373c4f78684220bfe3c055d84..249dac3363a8aabefb87b06586b7b5e568b46a43 100644 (file)
@@ -20,7 +20,7 @@
     <div class="m-row">
       <div class="m-col-l-10 m-push-l-1">
         <h1>
-          <div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="First_8h.html">&lt;First.h&gt;</a></div>
+          <div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="Second_8h.html">&lt;Second.h&gt;</a></div>
           <div class="m-doc-template">template&lt;class T&gt;</div>
           SpreadClass <span class="m-thin">struct</span>
         </h1>
             </li>
           </ul>
         </nav>
-<p>Because Doxygen is stupid, it reports the class to be defined in First.h even though there&#x27;s just a fwdecl. Happens only if the class is a template, a non-templated class would have its location reported correctly.</p><p>If includes are enabled, members should have Second.h listed as their include, but if they are disabled, brief-only members shouldn&#x27;t have detailed sections at all.</p>
+<p>Doxygen &lt; 1.8.20 is stupid and reports the class to be defined in First.h even though there&#x27;s just a fwdecl. Happens only if the class is a template, a non-templated class would have its location reported correctly.</p><p>With Doxygen &lt; 1.8.20, if includes are enabled, members should have Second.h listed as their include, but if they are disabled, brief-only members shouldn&#x27;t have detailed sections at all. With 1.8.20+, there should be just one (correct) include for the whole class.</p>
         <section id="pub-methods">
           <h2><a href="#pub-methods">Public functions</a></h2>
           <dl class="m-doc">
-            <dt>
-              <span class="m-doc-wrap-bumper">void <a href="#a0537e4d57c78086a29ab6143da0d9a21" class="m-doc">foo</a>(</span><span class="m-doc-wrap">)</span>
+            <dt id="a0537e4d57c78086a29ab6143da0d9a21">
+              <span class="m-doc-wrap-bumper">void <a href="#a0537e4d57c78086a29ab6143da0d9a21" class="m-doc-self">foo</a>(</span><span class="m-doc-wrap">)</span>
             </dt>
-            <dd>A function with (detailed) include information but no details if includes are disabled.</dd>
+            <dd>A function with (detailed) include information on &lt; 1.8.20 but no details if includes are disabled or on 1.8.20+.</dd>
           </dl>
         </section>
-        <section>
-          <h2>Function documentation</h2>
-          <section class="m-doc-details" id="a0537e4d57c78086a29ab6143da0d9a21"><div>
-            <h3>
-              <div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="Second_8h.html">&lt;Second.h&gt;</a></div>
-              <div class="m-doc-template">
-                template&lt;class T&gt;
-              </div>
-              <span class="m-doc-wrap-bumper">void SpreadClass&lt;T&gt;::<wbr /></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#a0537e4d57c78086a29ab6143da0d9a21" class="m-doc-self">foo</a>(</span><span class="m-doc-wrap">)</span></span>
-            </h3>
-            <p>A function with (detailed) include information but no details if includes are disabled.</p>
-          </div></section>
-        </section>
       </div>
     </div>
   </div>
index 0863f6755e460481de01d7eef2c6f41bfddb41d9..b9400a0cb6a3081aefd4cefc01e762a04aca67cd 100644 (file)
             </li>
           </ul>
         </nav>
-<p>Because Doxygen is stupid, it reports the class to be defined in First.h even though there&#x27;s just a fwdecl. Happens only if the class is a template, a non-templated class would have its location reported correctly.</p><p>If includes are enabled, members should have Second.h listed as their include, but if they are disabled, brief-only members shouldn&#x27;t have detailed sections at all.</p>
+<p>Doxygen &lt; 1.8.20 is stupid and reports the class to be defined in First.h even though there&#x27;s just a fwdecl. Happens only if the class is a template, a non-templated class would have its location reported correctly.</p><p>With Doxygen &lt; 1.8.20, if includes are enabled, members should have Second.h listed as their include, but if they are disabled, brief-only members shouldn&#x27;t have detailed sections at all. With 1.8.20+, there should be just one (correct) include for the whole class.</p>
         <section id="pub-methods">
           <h2><a href="#pub-methods">Public functions</a></h2>
           <dl class="m-doc">
             <dt id="a0537e4d57c78086a29ab6143da0d9a21">
               <span class="m-doc-wrap-bumper">void <a href="#a0537e4d57c78086a29ab6143da0d9a21" class="m-doc-self">foo</a>(</span><span class="m-doc-wrap">)</span>
             </dt>
-            <dd>A function with (detailed) include information but no details if includes are disabled.</dd>
+            <dd>A function with (detailed) include information on &lt; 1.8.20 but no details if includes are disabled or on 1.8.20+.</dd>
           </dl>
         </section>
       </div>
index bddea706a3176e039567e7eb5c009d5f809255d8..9e21f6cf683cc520ce999dc35736fde89e1cc168 100644 (file)
@@ -51,15 +51,16 @@ void relatedFunc();
 /**
 @brief A class forward-declared in one file but defined in another
 
-Because Doxygen is stupid, it reports the class to be defined in First.h even
-though there's just a fwdecl. Happens only if the class is a template,
-non-templated class would have its location reported correctly.
+Doxygen < 1.8.20 is stupid and reports the class to be defined in First.h even
+though there's just a fwdecl. Happens only if the class is a template, a
+non-templated class would have its location reported correctly.
 
-If includes are enabled, members should have Second.h listed as their include,
-but if they are disabled, brief-only members shouldn't have detailed sections
-at all.
+With Doxygen < 1.8.20, if includes are enabled, members should have Second.h
+listed as their include, but if they are disabled, brief-only members shouldn't
+have detailed sections at all. With 1.8.20+, there should be just one (correct)
+include for the whole class.
 */
 template<class T> struct SpreadClass {
-    /** @brief A function with (detailed) include information but no details if includes are disabled */
+    /** @brief A function with (detailed) include information on < 1.8.20 but no details if includes are disabled or on 1.8.20+ */
     void foo();
 };
index 622c63a4511d1f5b9e4b043945b0e58853c23893..5da1544799d40134a99768818b236fdad07bdc34 100644 (file)
@@ -270,7 +270,13 @@ class Includes(IntegrationTestCase):
         self.assertEqual(*self.actual_expected_contents('namespaceSpread.html'))
         self.assertEqual(*self.actual_expected_contents('classClass.html'))
         self.assertEqual(*self.actual_expected_contents('group__group.html'))
-        self.assertEqual(*self.actual_expected_contents('structSpreadClass.html'))
+
+        # The bug this tests for happens only on < 1.8.20. Maybe it's fixed in
+        # 1.8.19 already, but I only have 1.8.18 and 1.8.20 available to test.
+        if parse_version(doxygen_version()) >= parse_version("1.8.20"):
+            self.assertEqual(*self.actual_expected_contents('structSpreadClass.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('structSpreadClass.html', 'structSpreadClass-1818.html'))
 
         # These two should all have local includes because otherwise it gets
         # misleading; the Empty namespace a global one