Skip to content

Commit

Permalink
Fix to create a fake properly that takes a pointer to function return…
Browse files Browse the repository at this point in the history
…ing pointer (#77)

* Fix to create a fake properly that takes a pointer to function returning pointer

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
sangmo-kang and pre-commit-ci[bot] authored Apr 10, 2024
1 parent 5bc1545 commit de47f2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion autofff/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def _generateTypeDefForDecl(self, decl: Decl) -> str:
):
name = utils.create_typedef_name_for_fnc_ptr(decl, param)

param.type.type.type.declname = name
type = param.type.type.type
while not hasattr(type, "declname"):
type = type.type
type.declname = name
typedef = Typedef(name, param.quals, ["typedef"], param.type)

param.type = TypeDecl(
Expand Down
3 changes: 3 additions & 0 deletions examples/simple-headers/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ void Driver_PowerUp(Config (*config_cb)(void *arg));

void Driver_PowerDown(void);

/* Showcasing in-line function pointer parameters that return pointer */
void Driver_Register_Callback(void *(*cb)(void *arg));

int Driver_Deinitialize(void);

/* Showcasing inline definition workaround */
Expand Down

0 comments on commit de47f2d

Please sign in to comment.