Skip to content

Commit

Permalink
* Fix Parser on function pointer declarations starting with `typed…
Browse files Browse the repository at this point in the history
…ef struct` (pull bytedeco/javacpp-presets#1361)
  • Loading branch information
saudet committed Jun 10, 2023
1 parent 905ee6b commit b9f91d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

* Fix `Parser` on function pointer declarations starting with `typedef struct` ([pull bytedeco/javacpp-presets#1361](https://github.com/bytedeco/javacpp-presets/pull/1361))

### June 6, 2023 version 1.5.9
* Fix `Loader.extractResource()` for nested JAR files from Spring Boot ([pull #685](https://github.com/bytedeco/javacpp/pull/685))
* Have `Parser` desugar `...` varargs to array `[]` for return types as well ([pull #682](https://github.com/bytedeco/javacpp/pull/682))
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/bytedeco/javacpp/tools/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -3396,6 +3396,11 @@ boolean group(Context context, DeclarationList declList) throws ParserException
}
}
}
if (typedef && tokens.get().match('(')) {
// this is probably a function pointer declaration
tokens.index = backIndex;
return false;
}
if (typedef && type.indirections > 0) {
// skip pointer typedef
while (!tokens.get().match(';', Token.EOF)) {
Expand Down

0 comments on commit b9f91d7

Please sign in to comment.