fix: __attribute__ of declarator missing from AST (issues #706 and #602)#1
Open
Copilot wants to merge 2 commits into
Open
fix: __attribute__ of declarator missing from AST (issues #706 and #602)#1Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Copilot created this pull request from a session on behalf of
strimo378
May 6, 2026 01:03
View session
…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>
6571379 to
fe03a82
Compare
|
@copilot kanns du fixen, dass run 25411735548 durchläuft |
Author
The CI failure was a version baseline check: |
240c889 to
fe03a82
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
__attribute__prepended to a declarator was missing from the CDT AST in two cases:__attribute__prepended to a declarator in a multi-declarator list (e.g.extern int other, __attribute__((alias("target"))) error_decl;) was missing from the AST.__attribute__inside a nested declarator (e.g.extern int ( __attribute__((__artificial__)) func)();) was missing from the AST.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 thatbackup(mark)correctly restores to before the attribute, allowingdeclarator()to pick it up.startOffsetis updated to uselast.getOffset()(the*token's offset) sincemarknow points before any attribute.The
org.eclipse.cdt.corebundle version is bumped from9.3.100to9.3.101to satisfy the CI baseline version comparison check.Changes
GNUCSourceParser.java: reordermark()and__attribute_decl_seq()inconsumePointerOperators; adjuststartOffsetto use the consumed token's offsetAST2CPPAttributeTests.java: add two regression testsorg.eclipse.cdt.core/META-INF/MANIFEST.MF: bump bundle version from9.3.100to9.3.101Checklist: