diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index cf93ef8..a2da635 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -85,7 +85,7 @@ jobs: matrix: os: - windows-latest - - macos-13 + - macos-15-intel - ubuntu-22.04 python_version: - 3.7 @@ -97,7 +97,7 @@ jobs: - "3.13" architecture: [x86, x64] exclude: - - os: macos-13 + - os: macos-15-intel architecture: x86 - os: ubuntu-22.04 architecture: x86 diff --git a/cxxheaderparser/parser.py b/cxxheaderparser/parser.py index 49be8e4..8a64add 100644 --- a/cxxheaderparser/parser.py +++ b/cxxheaderparser/parser.py @@ -446,6 +446,11 @@ def _parse_namespace( while True: names.append(tok.value) + + atok = self.lex.token_if_in_set(self._attribute_start_tokens) + if atok: + self._consume_attribute(atok) + tok = self._next_token_must_be("DBL_COLON", endtok) if tok.type == endtok: break diff --git a/tests/test_namespaces.py b/tests/test_namespaces.py index 0b6892f..1e0c8ba 100644 --- a/tests/test_namespaces.py +++ b/tests/test_namespaces.py @@ -195,3 +195,14 @@ def test_ns_alias_global() -> None: ns_alias=[NamespaceAlias(alias="ANS", names=["::", "my", "ns"])] ) ) + + +def test_ns_attr() -> None: + content = """ + namespace n __attribute__((visibility("hidden"))) {} + """ + data = parse_string(content, cleandoc=True) + + assert data == ParsedData( + namespace=NamespaceScope(namespaces={"n": NamespaceScope(name="n")}) + )