Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for C++ style forward declares.
Browse files Browse the repository at this point in the history
In cimple, `struct X;` will now mean the same as `typedef struct X X;`,
which is (roughly) the same behaviour as in C++. This is only to support
having plain `struct X;` declarations where we put our comments vs.
having the typedefs surrounded by ifdefs for C99 reasons (benign typedef
redefinitions are a C11 feature).
iphydf committed Jan 24, 2025
1 parent 4168de6 commit 063186e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Language/Cimple/Parser.y
Original file line number Diff line number Diff line change
@@ -666,6 +666,7 @@ TypedefDecl :: { NonTerm }
TypedefDecl
: typedef QualType ID_SUE_TYPE ';' { Fix $ Typedef $2 $3 }
| typedef FunctionPrototype(ID_FUNC_TYPE) ';' { Fix $ TypedefFunction $2 }
| struct ID_SUE_TYPE ';' { Fix $ Typedef (Fix (TyStruct $2)) $2 }

QualType :: { NonTerm }
QualType

0 comments on commit 063186e

Please sign in to comment.