Merge pull request #22 from robotpy/fix-volatile

Support volatile keyword correctly
This commit is contained in:
Dustin Spicuzza 2021-08-16 16:09:42 -04:00 committed by GitHub
commit f9e19de5af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -1815,7 +1815,7 @@ class CxxParser:
return dtype
# Applies to variables and return values
_type_kwd_both = {"const", "constexpr", "extern", "inline", "static", "volatile"}
_type_kwd_both = {"const", "constexpr", "extern", "inline", "static"}
# Only found on methods
_type_kwd_meth = {"explicit", "virtual"}

View File

@ -876,3 +876,26 @@ def test_typedef_enum_expr():
],
)
)
def test_volatile_typedef():
content = """
typedef volatile signed short vint16;
"""
data = parse_string(content, cleandoc=True)
assert data == ParsedData(
namespace=NamespaceScope(
typedefs=[
Typedef(
type=Type(
typename=PQName(
segments=[FundamentalSpecifier(name="signed short")]
),
volatile=True,
),
name="vint16",
)
]
)
)