diff options
author | Eli Bendersky <eliben@gmail.com> | 2021-09-13 21:09:29 -0700 |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2021-09-13 21:09:29 -0700 |
commit | bdcc186728124e6a90ed865031f11fba84165c19 (patch) | |
tree | 3f53dfa6cc533198f42edbfff62917cf3affb901 /tests | |
parent | a1b5e46cf3015fe83c1f2a9de1a0e6d2fce76c19 (diff) | |
download | pycparser-bdcc186728124e6a90ed865031f11fba84165c19.tar.gz |
A different, more robust appoach to fix _Atomic specifiers.
Now the ASTs produced are more correct, and more complex cases work like
nested _Atomic(...) specifiers.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_c_parser.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/test_c_parser.py b/tests/test_c_parser.py index 492cbd1..40b53af 100755 --- a/tests/test_c_parser.py +++ b/tests/test_c_parser.py @@ -547,15 +547,30 @@ class TestCParser_fundamentals(TestCParser_base): def test_atomic_specifier(self): self.assertEqual(self.get_decl('_Atomic(int) ai;'), - ['Decl', - ['_Atomic'], + ['Decl', ['_Atomic'], 'ai', ['TypeDecl', ['IdentifierType', ['int']]]]) self.assertEqual(self.get_decl('_Atomic(int*) ai;'), ['Decl', 'ai', - ['TypeDecl', ['PtrDecl', ['_Atomic'], ['IdentifierType', ['int']]]]]) + ['PtrDecl', ['_Atomic'], ['TypeDecl', ['IdentifierType', ['int']]]]]) + + self.assertEqual(self.get_decl('_Atomic(_Atomic(int)*) aai;'), + ['Decl', ['_Atomic'], + 'aai', + ['PtrDecl', ['_Atomic'], ['TypeDecl', ['IdentifierType', ['int']]]]]) + + # Multiple declarations with _Atomic(...) + s = '_Atomic(int) foo, bar;' + self.assertEqual(self.get_decl(s, 0), + ['Decl', ['_Atomic'], + 'foo', + ['TypeDecl', ['IdentifierType', ['int']]]]) + self.assertEqual(self.get_decl(s, 1), + ['Decl', ['_Atomic'], + 'bar', + ['TypeDecl', ['IdentifierType', ['int']]]]) def test_sizeof(self): e = """ |