C++, also support 'extern' for functions.

Thanks to Victor Zverovich.
This commit is contained in:
Jakob Lykke Andersen 2016-03-31 13:40:02 +09:00
parent 68f3887428
commit 42395a177a
2 changed files with 7 additions and 5 deletions

View File

@ -91,8 +91,8 @@ from sphinx.util.docfields import Field, GroupedField
decl-specifier ->
storage-class-specifier ->
( "static" (only for member_object and function_object)
| "extern" (only for member_object and function_object)
| "register"
| "extern" (only for member_object)
)
thread_local[opt] (only for member_object)
(it can also appear before the others)
@ -3076,13 +3076,13 @@ class DefinitionParser(object):
if self.skip_word('static'):
storage = 'static'
continue
if self.skip_word('extern'):
storage = 'extern'
continue
if outer == 'member':
if self.skip_word('mutable'):
storage = 'mutable'
continue
if self.skip_word('extern'):
storage = 'extern'
continue
if self.skip_word('register'):
storage = 'register'
continue

View File

@ -261,6 +261,8 @@ def test_function_definitions():
check("function", "void f(int *const p)", "f__iPC", "1fPCi")
check("function", "void f(int *volatile const p)", "f__iPVC", "1fPVCi")
check('function', 'extern int f()', 'f', '1fv')
# TODO: make tests for functions in a template, e.g., Test<int&&()>
# such that the id generation for function type types is correct.