From 5a2b897bb7b3d209fa8da91aa4aaaef72933a5b7 Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Fri, 2 Apr 2021 20:16:31 +0200
Subject: [PATCH] hack(docs): Add workaround for Sphinx issue #8945

With sphinx 3 a ton of warnings about unresolvable xrefs are generated.
Add a workaround to silence them.

Ref: https://github.com/sphinx-doc/sphinx/issues/8945
---
 Documentation/conf.py | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 2f1e63fa1..94867ea8b 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -149,3 +149,32 @@ except ImportError as e:
 def setup(app):
     app.add_config_value("has_hawkmoth", has_hawkmoth, "")
     app.add_directive("color-example", ColorExample)
+    fix_issue_8945()
+
+
+def fix_issue_8945():
+    c_domain = __import__("sphinx.domains.c").domains.c
+
+    for kw in [
+        "char",
+        "float",
+        "int",
+        "long",
+        "short",
+        "void",
+        "_Bool",
+        "bool",
+        "_Complex",
+        "complex",
+    ]:
+        c_domain._keywords.remove(kw)
+
+    def parse_xref_object(self):
+        name = self._parse_nested_name()
+        self.skip_ws()
+        self.skip_string("()")
+        # Removing this line as a hacky workaround:
+        # self.assert_end()
+        return name
+
+    c_domain.DefinitionParser.parse_xref_object = parse_xref_object
-- 
GitLab