From 688f3496abc02e639cefd497eac55a34f9371965 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Sun, 14 Dec 2025 16:57:46 -0500 Subject: [PATCH 1/2] Support attributes on namespaces --- cxxheaderparser/parser.py | 5 +++++ tests/test_namespaces.py | 11 +++++++++++ 2 files changed, 16 insertions(+) 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")}) + ) From 9db92ec42a5101424924aa35f8281824ef675ee9 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Sun, 14 Dec 2025 17:07:18 -0500 Subject: [PATCH 2/2] Update CI --- .github/workflows/dist.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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