Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Lykke Andersen <Jakob@caput.dk>2021-01-17 15:45:49 +0300
committerJakob Lykke Andersen <Jakob@caput.dk>2021-02-12 19:25:12 +0300
commitde1cd95a75dc098fc0c81483b823b2bcea055079 (patch)
treef037c196b0d5d3829eaa4def0b4c3510c4168c3b /sphinx/domains
parent61af7f48adedf50c4b7b16c0772d6af15632db0a (diff)
C, fixes for alias directive
Diffstat (limited to 'sphinx/domains')
-rw-r--r--sphinx/domains/c.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py
index 5336b003c..c4ebdaf37 100644
--- a/sphinx/domains/c.py
+++ b/sphinx/domains/c.py
@@ -3459,9 +3459,9 @@ class AliasNode(nodes.Element):
class AliasTransform(SphinxTransform):
default_priority = ReferencesResolver.default_priority - 1
- def _render_symbol(self, s: Symbol, maxdepth: int, document: Any) -> List[Node]:
+ def _render_symbol(self, s: Symbol, maxdepth: int,
+ options: dict, document: Any) -> List[Node]:
nodes = [] # type: List[Node]
- options = dict() # type: ignore
signode = addnodes.desc_signature('', '')
nodes.append(signode)
s.declaration.describe_signature(signode, 'markName', self.env, options)
@@ -3483,7 +3483,9 @@ class AliasTransform(SphinxTransform):
desc['noindex'] = True
for sChild in s.children:
- childNodes = self._render_symbol(sChild, maxdepth, document)
+ if sChild.declaration is None:
+ continue
+ childNodes = self._render_symbol(sChild, maxdepth, options, document)
desc.extend(childNodes)
if len(desc.children) != 0:
@@ -3531,8 +3533,21 @@ class AliasTransform(SphinxTransform):
location=node)
node.replace_self(signode)
continue
+ if s.declaration is None:
+ signode = addnodes.desc_signature(sig, '')
+ node.append(signode)
+ signode.clear()
+ signode += addnodes.desc_name(sig, sig)
+
+ logger.warning(
+ "Can not render C declaration for alias '%s'. No such declaration." % name,
+ location=node)
+ node.replace_self(signode)
+ continue
- nodes = self._render_symbol(s, maxdepth=node.maxdepth, document=node.document)
+ options = dict() # type: ignore
+ nodes = self._render_symbol(s, maxdepth=node.maxdepth,
+ options=options, document=node.document)
node.replace_self(nodes)