Skip to content

Commit

Permalink
C, move info-fields from all objects to just function and macro
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobandersen committed Oct 1, 2021
1 parent 063dcfd commit dd53cd2
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions sphinx/domains/c.py
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit dd53cd2

Please sign in to comment.