mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
C, changelog and test for named variadic args
This commit is contained in:
@@ -37,6 +37,7 @@ Features added
|
||||
The warnings printed from this functionality can be suppressed by setting
|
||||
:confval:`c_warn_on_allowed_pre_v3`` to ``True``.
|
||||
The functionality is immediately deprecated.
|
||||
* #7999: C, add support for named variadic macro arguments.
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
@@ -2922,6 +2922,8 @@ class DefinitionParser(BaseParser):
|
||||
if not self.match(identifier_re):
|
||||
self.fail("Expected identifier in macro parameters.")
|
||||
nn = ASTNestedName([ASTIdentifier(self.matched_text)], rooted=False)
|
||||
# Allow named variadic args:
|
||||
# https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
|
||||
self.skip_ws()
|
||||
if self.skip_string_and_ws('...'):
|
||||
args.append(ASTMacroParameter(nn, False, True))
|
||||
|
||||
@@ -296,6 +296,10 @@ def test_macro_definitions():
|
||||
check('macro', 'M(arg, ...)', {1: 'M'})
|
||||
check('macro', 'M(arg1, arg2, ...)', {1: 'M'})
|
||||
check('macro', 'M(arg1, arg2, arg3, ...)', {1: 'M'})
|
||||
# GNU extension
|
||||
check('macro', 'M(arg1, arg2, arg3...)', {1: 'M'})
|
||||
with pytest.raises(DefinitionError):
|
||||
check('macro', 'M(arg1, arg2..., arg3)', {1: 'M'})
|
||||
|
||||
|
||||
def test_member_definitions():
|
||||
|
||||
Reference in New Issue
Block a user