GCC emits this warning for mismatched function types unless the generic void (*) (void) signature is used ([1]) - e.g.:
warning: cast between incompatible function types from ‘int (*)(const char *)’ to ‘int (*)(void)’ [-Wcast-function-type] [1] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcast-function-type Signed-off-by: Philip Lorenz <[email protected]> --- ports/linux/pseudo_wrappers.c | 4 ++-- pseudo_wrappers.c | 2 +- templates/wrapper_table | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ports/linux/pseudo_wrappers.c b/ports/linux/pseudo_wrappers.c index ed34115..7659897 100644 --- a/ports/linux/pseudo_wrappers.c +++ b/ports/linux/pseudo_wrappers.c @@ -96,7 +96,7 @@ syscall(long number, ...) { * guess about the number of args; the docs discuss calling conventions * up to 7, so let's try that? */ - void *res = __builtin_apply((void (*)()) real_syscall, __builtin_apply_args(), sizeof(long) * 7); + void *res = __builtin_apply((void (*)(void)) real_syscall, __builtin_apply_args(), sizeof(long) * 7); __builtin_return(res); } @@ -137,7 +137,7 @@ prctl(int option, ...) { * guess about the number of args; the docs discuss calling conventions * up to 5, so let's try that? */ - void *res = __builtin_apply((void (*)()) real_prctl, __builtin_apply_args(), sizeof(long) * 5); + void *res = __builtin_apply((void (*)(void)) real_prctl, __builtin_apply_args(), sizeof(long) * 5); __builtin_return(res); } diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c index 99aabff..9ae1200 100644 --- a/pseudo_wrappers.c +++ b/pseudo_wrappers.c @@ -140,7 +140,7 @@ pseudo_init_one_wrapper(pseudo_function *func) { #endif f = dlsym(RTLD_NEXT, func->name); if (f) { - *func->real = f; + *func->real = (void (*)(void)) f; } /* it turns out that in some cases, we get apparently-harmless * errors if a function is missing, and that printing output diff --git a/templates/wrapper_table b/templates/wrapper_table index bb30530..498ca81 100644 --- a/templates/wrapper_table +++ b/templates/wrapper_table @@ -6,8 +6,8 @@ * script if you want to modify this. */ typedef struct { char *name; /* the name */ - int (**real)(void); /* the underlying syscall */ - int (*wrapper)(void); /* the wrapper from guts/name.c */ + void (**real)(void); /* the underlying syscall */ + void (*wrapper)(void); /* the wrapper from guts/name.c */ char *version; /* the version, if we know and care */ } pseudo_function; @@ -15,8 +15,8 @@ static pseudo_function pseudo_functions[] = { @body { /* ${comment}; */ "${name}${maybe_inode64}", - (int (**)(void)) &real_${name}, - (int (*)(void)) wrap_${name}, + (void (**)(void)) &real_${name}, + (void (*)(void)) wrap_${name}, ${version} }, @footer -- 2.31.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#151990): https://lists.openembedded.org/g/openembedded-core/message/151990 Mute This Topic: https://lists.openembedded.org/mt/82895243/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
