Skip to content

fix: __attribute__ of declarator missing from AST (issues #706 and #602)#1

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-issue-706
Open

fix: __attribute__ of declarator missing from AST (issues #706 and #602)#1
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-issue-706

Conversation

Copy link
Copy Markdown

Copilot AI commented May 6, 2026

Description

__attribute__ prepended to a declarator was missing from the CDT AST in two cases:

In GNUCSourceParser.consumePointerOperators(), IToken mark = mark() was called after __attribute_decl_seq() consumed any attributes. When no pointer operator (*) followed the attribute, backup(mark) restored only to after the attribute — permanently losing it from the token stream.

The fix moves IToken mark = mark() to before the __attribute_decl_seq() call so that backup(mark) correctly restores to before the attribute, allowing declarator() to pick it up. startOffset is updated to use last.getOffset() (the * token's offset) since mark now points before any attribute.

The org.eclipse.cdt.core bundle version is bumped from 9.3.100 to 9.3.101 to satisfy the CI baseline version comparison check.

Changes

  • GNUCSourceParser.java: reorder mark() and __attribute_decl_seq() in consumePointerOperators; adjust startOffset to use the consumed token's offset
  • AST2CPPAttributeTests.java: add two regression tests
  • org.eclipse.cdt.core/META-INF/MANIFEST.MF: bump bundle version from 9.3.100 to 9.3.101

Checklist:

…cdt#706 and eclipse-cdt#602)

Move `mark()` call to before `__attribute_decl_seq()` in
`GNUCSourceParser.consumePointerOperators()` so that when no pointer
operator follows an attribute, `backup(mark)` correctly restores the
token stream to before the attribute. Previously, the mark was set
*after* consuming the attribute, so the attribute was permanently lost.

Also update `startOffset` to use `last.getOffset()` (the offset of the
`*` token) instead of `mark.getOffset()` to preserve correct pointer
operator location information.

Agent-Logs-Url: https://github.com/emmtrix/cdt/sessions/64cb901c-b4db-40ca-bc5e-49f7c8ae83a2

Co-authored-by: strimo378 <59825937+strimo378@users.noreply.github.com>
@strimo378 strimo378 force-pushed the copilot/fix-issue-706 branch from 6571379 to fe03a82 Compare May 6, 2026 01:34
@strimo378 strimo378 marked this pull request as ready for review May 6, 2026 01:37
@strimo378 strimo378 closed this May 6, 2026
@strimo378 strimo378 reopened this May 6, 2026
@strimo378
Copy link
Copy Markdown

@copilot kanns du fixen, dass run 25411735548 durchläuft

Copy link
Copy Markdown
Author

Copilot AI commented May 6, 2026

@copilot kanns du fixen, dass run 25411735548 durchläuft

The CI failure was a version baseline check: org.eclipse.cdt.core had only its build qualifier changed, but the baseline requires a proper x.y.z bump. Fixed in commit 240c8890 by bumping the bundle version from 9.3.100 to 9.3.101.

@strimo378 strimo378 force-pushed the copilot/fix-issue-706 branch from 240c889 to fe03a82 Compare May 6, 2026 08:15
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Test Results

4 720 tests  +2   4 711 ✅ +2   2m 39s ⏱️ +7s
  182 suites ±0       9 💤 ±0 
  182 files   ±0       0 ❌ ±0 

Results for commit fc81bb4. ± Comparison against base commit acd4556.

♻️ This comment has been updated with latest results.

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.

2 participants