Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building tests/memsave.c with clang-15 and -Werror=incompatible-function-pointer-types failes #1149

Closed
dl1jbe opened this issue Nov 14, 2022 · 4 comments
Labels
bug build needs test Patches have been submitted but need testing to close issue
Milestone

Comments

@dl1jbe
Copy link
Contributor

dl1jbe commented Nov 14, 2022

Coming clang-16 will force the above -Werror check to fail. During tests here at gentoo linux we observed the following (see also https://bugs.gentoo.org/880961)

memsave.c:65:53: error: incompatible function pointer types passing 'int (RIG *, vfo_t, channel_t **, int, const chan_t *, void *)' (aka 'int (struct s_rig *, unsigned int, struct channel **, int, const struct chan_list *, void *)') to parameter of type 'chan_cb_t' (aka 'int (*)(struct s_rig *, struct channel **, int, const struct chan_list *, void *)') [-Werror,-Wincompatible-function-pointer-types] retval = rig_get_chan_all_cb(rig, RIG_VFO_NONE, dump_xml_chan, root); ^~~~~~~~~~~~~ ../include/hamlib/rig.h:2953:46: note: passing argument to parameter 'chan_cb' here chan_cb_t chan_cb, ^

Seems declaration and definition of callback function static int dump_xml_chan on lines 32 and 87 should drop second parameter (vfo_t vfo).

@mdblack98
Copy link
Contributor

Try changing
typedef int (* chan_cb_t)(RIG *, channel_t **, int, const chan_t , rig_ptr_t);
To
typedef int (
chan_cb_t)(RIG *, vfo_t vfo, channel_t **, int, const chan_t *, rig_ptr_t);

See if that clears up the error. If it does I'll post a patch.

@mdblack98 mdblack98 added the bug label Nov 14, 2022
@mdblack98 mdblack98 added this to the 4.5.1 milestone Nov 14, 2022
@dl1jbe
Copy link
Contributor Author

dl1jbe commented Nov 14, 2022

It seems not to be so easy.

Changing it in include/hamlib/rig.h resuts in aor.c no longer compiling.

`
aor.c:1371:59: error: too few arguments to function call, expected 6, have 5
retval = chan_cb(rig, &chan, chan_next, chan_list, arg);
~~~~~~~ ^
'

Same on line 1421. Adding the vfo parameter helps.

But a lot of similar errors turns up in mem.c too. 3 times not enough parameters and 6 times incompatible pointer types.

Maybe there are more problems in further files.

@mdblack98
Copy link
Contributor

mdblack98 commented Nov 14, 2022 via email

@mdblack98 mdblack98 added the needs test Patches have been submitted but need testing to close issue label Nov 14, 2022
mdblack98 added a commit that referenced this issue Nov 14, 2022
@dl1jbe
Copy link
Contributor Author

dl1jbe commented Nov 17, 2022

Looks good so far. No runtime tests yet, but compiles cleanly (even if backported to Hamlib-4.4).
Thanks.

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Nov 17, 2022
Backported from Hamlib repo i
(see Hamlib/Hamlib#1149)

Closes: https://bugs.gentoo.org/880961
Signed-off-by: Thomas Beierlein <tomjbe@gentoo.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug build needs test Patches have been submitted but need testing to close issue
Projects
None yet
Development

No branches or pull requests

2 participants