From 7ae4b8259aeac9c18f93a06b9b6edb6696fd7677 Mon Sep 17 00:00:00 2001 From: Jakob Lykke Andersen Date: Fri, 29 Jan 2021 21:42:04 +0100 Subject: [PATCH 1/2] Add various specifiers to functions and variables Fixes part 1 of michaeljones/breathe#600 --- breathe/renderer/sphinxrenderer.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/breathe/renderer/sphinxrenderer.py b/breathe/renderer/sphinxrenderer.py index 629b7555..616de03e 100644 --- a/breathe/renderer/sphinxrenderer.py +++ b/breathe/renderer/sphinxrenderer.py @@ -1607,8 +1607,19 @@ def visit_function(self, node) -> List[Node]: declaration = name + node.get_argsstring() else: elements = [self.create_template_prefix(node)] + if node.static == 'yes': + elements.append('static') + if node.inline == 'yes': + elements.append('inline') if node.kind == 'friend': elements.append('friend') + if node.virt in ('virtual', 'pure-virtual'): + elements.append('virtual') + if node.explicit == 'yes': + elements.append('explicit') + if 'constexpr' in dir(node): + assert node.constexpr == 'yes' + elements.append('constexpr') elements.append(''.join(n.astext() for n in self.render(node.get_type()))) # type: ignore elements.append(name) @@ -1758,16 +1769,19 @@ def visit_variable(self, node) -> List[Node]: if len(initializer) != 0: options['value'] = initializer else: + elements = [self.create_template_prefix(node)] + if node.static == 'yes': + elements.append('static') + if node.mutable == 'yes': + elements.append('mutable') typename = ''.join(n.astext() for n in self.render(node.get_type())) if dom == 'c' and '::' in typename: typename = typename.replace('::', '.') - declaration = ' '.join([ - self.create_template_prefix(node), - typename, - name, - node.get_argsstring(), - self.make_initializer(node) - ]) + elements.append(typename) + elements.append(name) + elements.append(node.get_argsstring()) + elements.append(self.make_initializer(node)) + declaration = ' '.join(elements) if not dom or dom in ('c', 'cpp', 'py', 'cs'): return self.handle_declaration(node, declaration, options=options) else: From a63332583183fdc33dcd8b0d5a5f3321aeb66f75 Mon Sep 17 00:00:00 2001 From: Melvin Vermeeren Date: Tue, 2 Feb 2021 16:46:50 +0100 Subject: [PATCH 2/2] tests: ignore mypy errors in conf.py These errors newly occur in CICD, likely a new mypy version was pulled in recently. Ignore the entire file as it's just configuration settings. --- tests/warnings/source/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/warnings/source/conf.py b/tests/warnings/source/conf.py index cf2a8d20..a282b757 100644 --- a/tests/warnings/source/conf.py +++ b/tests/warnings/source/conf.py @@ -11,6 +11,8 @@ # # All configuration values have a default; values that are commented out # serve to show the default. +# +# mypy: ignore-errors import sys import os