Message ID | 20200930155859.303148-4-borntraeger@de.ibm.com |
---|---|
State | New |
Headers | show |
Series | assorted gcc 10/fedora32 compile warning fixes | expand |
* Christian Borntraeger (borntraeger@de.ibm.com) wrote: > With gcc 10 on Fedora32 I do get: > > Compiling C object libblock.fa.p/qemu-io-cmds.c.o > In file included from /usr/include/stdio.h:867, > from /home/cborntra/REPOS/qemu/include/qemu/osdep.h:85, > from ../qemu-io-cmds.c:11: > In function ‘printf’, > inlined from ‘help_oneline’ at ../qemu-io-cmds.c:2389:9, > inlined from ‘help_all’ at ../qemu-io-cmds.c:2414:9, > inlined from ‘help_f’ at ../qemu-io-cmds.c:2424:9: > /usr/include/bits/stdio2.h:107:10: error: ‘%s’ directive argument is null [-Werror=format-overflow=] > 107 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > > Let us check for null. > > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> I'd already posted 'qemu-io-cmds: Simplify help_oneline' that simplifies this function much more; Kevin picked that up for the block branch a couple of days ago. Dave > --- > qemu-io-cmds.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c > index baeae86d8c85..c2080aa398a9 100644 > --- a/qemu-io-cmds.c > +++ b/qemu-io-cmds.c > @@ -2386,7 +2386,9 @@ static void help_oneline(const char *cmd, const cmdinfo_t *ct) > if (cmd) { > printf("%s ", cmd); > } else { > - printf("%s ", ct->name); > + if (ct->name) { > + printf("%s ", ct->name); > + } > if (ct->altname) { > printf("(or %s) ", ct->altname); > } > -- > 2.26.2 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
On 9/30/20 5:58 PM, Christian Borntraeger wrote: > With gcc 10 on Fedora32 I do get: > > Compiling C object libblock.fa.p/qemu-io-cmds.c.o > In file included from /usr/include/stdio.h:867, > from /home/cborntra/REPOS/qemu/include/qemu/osdep.h:85, > from ../qemu-io-cmds.c:11: > In function ‘printf’, > inlined from ‘help_oneline’ at ../qemu-io-cmds.c:2389:9, > inlined from ‘help_all’ at ../qemu-io-cmds.c:2414:9, > inlined from ‘help_f’ at ../qemu-io-cmds.c:2424:9: > /usr/include/bits/stdio2.h:107:10: error: ‘%s’ directive argument is null [-Werror=format-overflow=] > 107 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > > Let us check for null. > > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> > --- > qemu-io-cmds.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c > index baeae86d8c85..c2080aa398a9 100644 > --- a/qemu-io-cmds.c > +++ b/qemu-io-cmds.c > @@ -2386,7 +2386,9 @@ static void help_oneline(const char *cmd, const cmdinfo_t *ct) > if (cmd) { > printf("%s ", cmd); > } else { > - printf("%s ", ct->name); > + if (ct->name) { > + printf("%s ", ct->name); > + } > if (ct->altname) { > printf("(or %s) ", ct->altname); > } > This one has been fixed last month: https://www.mail-archive.com/qemu-devel@nongnu.org/msg732728.html Then queued recently: https://www.mail-archive.com/qemu-devel@nongnu.org/msg745394.html
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index baeae86d8c85..c2080aa398a9 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -2386,7 +2386,9 @@ static void help_oneline(const char *cmd, const cmdinfo_t *ct) if (cmd) { printf("%s ", cmd); } else { - printf("%s ", ct->name); + if (ct->name) { + printf("%s ", ct->name); + } if (ct->altname) { printf("(or %s) ", ct->altname); }
With gcc 10 on Fedora32 I do get: Compiling C object libblock.fa.p/qemu-io-cmds.c.o In file included from /usr/include/stdio.h:867, from /home/cborntra/REPOS/qemu/include/qemu/osdep.h:85, from ../qemu-io-cmds.c:11: In function ‘printf’, inlined from ‘help_oneline’ at ../qemu-io-cmds.c:2389:9, inlined from ‘help_all’ at ../qemu-io-cmds.c:2414:9, inlined from ‘help_f’ at ../qemu-io-cmds.c:2424:9: /usr/include/bits/stdio2.h:107:10: error: ‘%s’ directive argument is null [-Werror=format-overflow=] 107 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Let us check for null. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> --- qemu-io-cmds.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)