From dd53cd2f8c78737aac1ae38a3d4ab8470fb875fe Mon Sep 17 00:00:00 2001 From: Jakob Lykke Andersen Date: Fri, 1 Oct 2021 17:45:10 +0200 Subject: [PATCH] C, move info-fields from all objects to just function and macro --- sphinx/domains/c.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py index 3950b5f640a..9acbdd5f821 100644 --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -3130,18 +3130,6 @@ class CObject(ObjectDescription[ASTDeclaration]): Description of a C language object. """ - doc_field_types = [ - TypedField('parameter', label=_('Parameters'), - names=('param', 'parameter', 'arg', 'argument'), - typerolename='expr', typenames=('type',)), - GroupedField('retval', label=_('Return values'), - names=('retvals', 'retval')), - Field('returnvalue', label=_('Returns'), has_arg=False, - names=('returns', 'return')), - Field('returntype', label=_('Return type'), has_arg=False, - names=('rtype',)), - ] - option_spec: OptionSpec = { 'noindexentry': directives.flag, } @@ -3344,13 +3332,30 @@ def display_object_type(self) -> str: return self.objtype +_function_doc_field_types = [ + TypedField('parameter', label=_('Parameters'), + names=('param', 'parameter', 'arg', 'argument'), + typerolename='expr', typenames=('type',)), + GroupedField('retval', label=_('Return values'), + names=('retvals', 'retval')), + Field('returnvalue', label=_('Returns'), has_arg=False, + names=('returns', 'return')), + Field('returntype', label=_('Return type'), has_arg=False, + names=('rtype',)), +] + + class CFunctionObject(CObject): object_type = 'function' + doc_field_types = _function_doc_field_types.copy() + class CMacroObject(CObject): object_type = 'macro' + doc_field_types = _function_doc_field_types.copy() + class CStructObject(CObject): object_type = 'struct'