diff --git a/autofff/generator.py b/autofff/generator.py index 09fb5c6..34d6bda 100644 --- a/autofff/generator.py +++ b/autofff/generator.py @@ -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( diff --git a/examples/simple-headers/driver.h b/examples/simple-headers/driver.h index 5574b59..271444d 100644 --- a/examples/simple-headers/driver.h +++ b/examples/simple-headers/driver.h @@ -36,6 +36,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 */