warnings when building lockstep plugin on s390
Near the top of a build log for the ubuntu-20.04-s390x-all CI job are the following warnings for the lockstep plugin:
(example job: https://gitlab.com/qemu-project/qemu/-/jobs/6138710238 -- you'll need to follow the "Complete Raw" link to see this bit of the output):
/home/gitlab-runner/builds/-LCfcJ2T/0/qemu-project/qemu/contrib/plugins/lockstep.c: In function ‘report_divergance’:
/home/gitlab-runner/builds/-LCfcJ2T/0/qemu-project/qemu/contrib/plugins/lockstep.c:133:38: warning: implicit declaration of function ‘g_memdup2’; did you mean ‘g_memdup’? [-Wimplicit-function-declaration]
133 | g_memdup2(&divrec, sizeof(divrec)));
| ^~~~~~~~~
| g_memdup
/home/gitlab-runner/builds/-LCfcJ2T/0/qemu-project/qemu/contrib/plugins/lockstep.c:133:38: warning: passing argument 2 of ‘g_slist_prepend’ makes pointer from integer without a cast [-Wint-conversion]
133 | g_memdup2(&divrec, sizeof(divrec)));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
In file included from /usr/include/glib-2.0/glib/gmain.h:26,
from /usr/include/glib-2.0/glib/giochannel.h:33,
from /usr/include/glib-2.0/glib.h:54,
from /home/gitlab-runner/builds/-LCfcJ2T/0/qemu-project/qemu/contrib/plugins/lockstep.c:26:
/usr/include/glib-2.0/glib/gslist.h:61:10: note: expected ‘gpointer’ {aka ‘void *’} but argument is of type ‘int’
61 | GSList* g_slist_prepend (GSList *list,
| ^~~~~~~~~~~~~~~
Two problems here:
- Warnings should make the build fail, so something somewhere here has not got the right set of warning/-Werror flags
- We shouldn't be generating a warning. g_memdup2() only exists on glib 2.68 or newer, which is why our include/glib-compat.h has a back-compat implementation for it. Since plugins don't get to use our back-compat machinery, they should avoid g_memdup2() (or provide their own back-compat handling).
Bug introduced in commit ee293103 ("plugins: update lockstep to use g_memdup2") by @stsquad :-)
Edited by Peter Maydell