Skip to content

Conversation

@retif
Copy link
Collaborator

@retif retif commented Nov 8, 2025

Fixes #33

Adds support for parsing GNU C extension syntax:

register int my_var asm("my_reg"); 

google-labs-jules bot and others added 3 commits November 8, 2025 11:42
Adds support for `asm` attributes on `register` variables by allowing `asm` and `attributes` to be added to `TypeDeclExt` and `ArrayDeclExt` nodes.

This was preventing the parser from attaching `asm` labels to declarations with storage-class specifiers like `register`.

A new test case, `test_register_asm_label`, is added to verify that declarations like `register int my_var asm("my_reg");` are now parsed correctly.
This commit enhances the test_register_asm_label test to include
round-trip testing, which was the main issue reported in inducer#33.

The original issue stated: 'when I convert it back to C-Code then no
C-Code is created for this line.'

This fix adds:
- Round-trip test for basic asm syntax
- Round-trip test for __asm__ variant
- Round-trip test for different type specifiers

All tests verify that parsing and code generation work correctly.
- Change single quotes to double quotes in __slots__ declarations
- Fix import ordering (pycparser before pycparserext)
- Standardize quote style in test assertions
@inducer inducer merged commit 834b63e into inducer:main Nov 10, 2025
4 checks passed
@inducer
Copy link
Owner

inducer commented Nov 10, 2025

Thx!

@retif retif deleted the issue-33-fix-register-asm-parsing branch November 10, 2025 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for register type xxx __asm__(yyy)

2 participants