mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-25 06:38:09 -05:00
C, parse all types of array declarators
This commit is contained in:
1 parent
31a34c2cd1
commit
082bf7d166
3 files changed
+101
-17
No files matched your search
@@ -354,6 +354,21 @@ def test_function_definitions():
|
||||
check('function', 'void f(enum E e)', {1: 'f'})
|
||||
check('function', 'void f(union E e)', {1: 'f'})
|
||||
|
||||
# array declarators
|
||||
check('function', 'void f(int arr[])', {1: 'f'})
|
||||
check('function', 'void f(int arr[*])', {1: 'f'})
|
||||
cvrs = ['', 'const', 'volatile', 'restrict', 'restrict volatile const']
|
||||
for cvr in cvrs:
|
||||
space = ' ' if len(cvr) != 0 else ''
|
||||
check('function', 'void f(int arr[{}*])'.format(cvr), {1: 'f'})
|
||||
check('function', 'void f(int arr[{}])'.format(cvr), {1: 'f'})
|
||||
check('function', 'void f(int arr[{}{}42])'.format(cvr, space), {1: 'f'})
|
||||
check('function', 'void f(int arr[static{}{} 42])'.format(space, cvr), {1: 'f'})
|
||||
check('function', 'void f(int arr[{}{}static 42])'.format(cvr, space), {1: 'f'},
|
||||
output='void f(int arr[static{}{} 42])'.format(space, cvr))
|
||||
check('function', 'void f(int arr[const static volatile 42])', {1: 'f'},
|
||||
output='void f(int arr[static volatile const 42])')
|
||||
|
||||
|
||||
def test_union_definitions():
|
||||
check('struct', 'A', {1: 'A'})
|
||||
|
||||
Reference in new issue
Block a user