Message ID | 0b0baf0b0f0132a615e20fb7944d7cecac23933a.1501084908.git.alistair.francis@xilinx.com |
---|---|
State | New |
Headers | show |
On Wed, Jul 26, 2017 at 09:07:59AM -0700, Alistair Francis wrote: > Convert any remaining uses of fprintf(stderr, "warning:"... > to use warn_report() instead. This helps standardise on a single > method of printing warnings to the user. > > All of the warnings were changed using this command: > find ./* -type f -exec sed -i 's|fprintf(.*".*warning[,:] |warn_report("|Ig' {} + > > The #include lines and chagnes to the test Makefile were manually > updated to allow the code to compile. > > Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> > --- > > tests/Makefile.include | 4 ++-- > util/cutils.c | 3 ++- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/tests/Makefile.include b/tests/Makefile.include > index 7af278db55..4886caf565 100644 > --- a/tests/Makefile.include > +++ b/tests/Makefile.include > @@ -560,8 +560,8 @@ tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y) > tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y) > tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y) > tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o > -tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y) > -tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o > +tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-qom-obj-y) > +tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-qom-obj-y) This doesn't look right to me - $(test-qom-obj-y) is the same as $(test-util-obj-y), but with $(qom-obj-y) added. AFAIK, your warn_report function doesn't use any code from $(qom-obj-y), so we should not need to link to that. So I think there's something else going on here. > diff --git a/util/cutils.c b/util/cutils.c > index 1534682083..b33ede83d1 100644 > --- a/util/cutils.c > +++ b/util/cutils.c > @@ -30,6 +30,7 @@ > #include "qemu/iov.h" > #include "net/net.h" > #include "qemu/cutils.h" > +#include "qemu/error-report.h" > > void strpadcpy(char *buf, int buf_size, const char *str, char pad) > { > @@ -601,7 +602,7 @@ int parse_debug_env(const char *name, int max, int initial) > return initial; > } > if (debug < 0 || debug > max || errno != 0) { > - fprintf(stderr, "warning: %s not in [0, %d]", name, max); > + warn_report("%s not in [0, %d]", name, max); > return initial; > } > return debug; > -- > 2.11.0 > > Regards, Daniel
On Wed, Jul 26, 2017 at 9:28 AM, Daniel P. Berrange <berrange@redhat.com> wrote: > On Wed, Jul 26, 2017 at 09:07:59AM -0700, Alistair Francis wrote: >> Convert any remaining uses of fprintf(stderr, "warning:"... >> to use warn_report() instead. This helps standardise on a single >> method of printing warnings to the user. >> >> All of the warnings were changed using this command: >> find ./* -type f -exec sed -i 's|fprintf(.*".*warning[,:] |warn_report("|Ig' {} + >> >> The #include lines and chagnes to the test Makefile were manually >> updated to allow the code to compile. >> >> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> >> --- >> >> tests/Makefile.include | 4 ++-- >> util/cutils.c | 3 ++- >> 2 files changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/tests/Makefile.include b/tests/Makefile.include >> index 7af278db55..4886caf565 100644 >> --- a/tests/Makefile.include >> +++ b/tests/Makefile.include >> @@ -560,8 +560,8 @@ tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y) >> tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y) >> tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y) >> tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o >> -tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y) >> -tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o >> +tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-qom-obj-y) >> +tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-qom-obj-y) > > This doesn't look right to me - $(test-qom-obj-y) is the same as > $(test-util-obj-y), but with $(qom-obj-y) added. AFAIK, your > warn_report function doesn't use any code from $(qom-obj-y), so > we should not need to link to that. So I think there's something > else going on here. The problem I was seeing is that monitor_get_fd() is getting called in stubs/monitor.c which then requires error_setg_internal() to be linked in. Apparently this doesn't happen without this change as I kept seeing linker errors. Thanks, Alistair > >> diff --git a/util/cutils.c b/util/cutils.c >> index 1534682083..b33ede83d1 100644 >> --- a/util/cutils.c >> +++ b/util/cutils.c >> @@ -30,6 +30,7 @@ >> #include "qemu/iov.h" >> #include "net/net.h" >> #include "qemu/cutils.h" >> +#include "qemu/error-report.h" >> >> void strpadcpy(char *buf, int buf_size, const char *str, char pad) >> { >> @@ -601,7 +602,7 @@ int parse_debug_env(const char *name, int max, int initial) >> return initial; >> } >> if (debug < 0 || debug > max || errno != 0) { >> - fprintf(stderr, "warning: %s not in [0, %d]", name, max); >> + warn_report("%s not in [0, %d]", name, max); >> return initial; >> } >> return debug; >> -- >> 2.11.0 >> >> > > Regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
On Wed, Jul 26, 2017 at 09:33:56AM -0700, Alistair Francis wrote: > On Wed, Jul 26, 2017 at 9:28 AM, Daniel P. Berrange <berrange@redhat.com> wrote: > > On Wed, Jul 26, 2017 at 09:07:59AM -0700, Alistair Francis wrote: > >> Convert any remaining uses of fprintf(stderr, "warning:"... > >> to use warn_report() instead. This helps standardise on a single > >> method of printing warnings to the user. > >> > >> All of the warnings were changed using this command: > >> find ./* -type f -exec sed -i 's|fprintf(.*".*warning[,:] |warn_report("|Ig' {} + > >> > >> The #include lines and chagnes to the test Makefile were manually > >> updated to allow the code to compile. > >> > >> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> > >> --- > >> > >> tests/Makefile.include | 4 ++-- > >> util/cutils.c | 3 ++- > >> 2 files changed, 4 insertions(+), 3 deletions(-) > >> > >> diff --git a/tests/Makefile.include b/tests/Makefile.include > >> index 7af278db55..4886caf565 100644 > >> --- a/tests/Makefile.include > >> +++ b/tests/Makefile.include > >> @@ -560,8 +560,8 @@ tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y) > >> tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y) > >> tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y) > >> tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o > >> -tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y) > >> -tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o > >> +tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-qom-obj-y) > >> +tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-qom-obj-y) > > > > This doesn't look right to me - $(test-qom-obj-y) is the same as > > $(test-util-obj-y), but with $(qom-obj-y) added. AFAIK, your > > warn_report function doesn't use any code from $(qom-obj-y), so > > we should not need to link to that. So I think there's something > > else going on here. > > The problem I was seeing is that monitor_get_fd() is getting called in > stubs/monitor.c which then requires error_setg_internal() to be linked > in. Apparently this doesn't happen without this change as I kept > seeing linker errors. That's bizarre because error_setg_internal is included in libqemuutil.la that we're already linking to. Regards, Daniel
On Wed, Jul 26, 2017 at 9:36 AM, Daniel P. Berrange <berrange@redhat.com> wrote: > On Wed, Jul 26, 2017 at 09:33:56AM -0700, Alistair Francis wrote: >> On Wed, Jul 26, 2017 at 9:28 AM, Daniel P. Berrange <berrange@redhat.com> wrote: >> > On Wed, Jul 26, 2017 at 09:07:59AM -0700, Alistair Francis wrote: >> >> Convert any remaining uses of fprintf(stderr, "warning:"... >> >> to use warn_report() instead. This helps standardise on a single >> >> method of printing warnings to the user. >> >> >> >> All of the warnings were changed using this command: >> >> find ./* -type f -exec sed -i 's|fprintf(.*".*warning[,:] |warn_report("|Ig' {} + >> >> >> >> The #include lines and chagnes to the test Makefile were manually >> >> updated to allow the code to compile. >> >> >> >> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> >> >> --- >> >> >> >> tests/Makefile.include | 4 ++-- >> >> util/cutils.c | 3 ++- >> >> 2 files changed, 4 insertions(+), 3 deletions(-) >> >> >> >> diff --git a/tests/Makefile.include b/tests/Makefile.include >> >> index 7af278db55..4886caf565 100644 >> >> --- a/tests/Makefile.include >> >> +++ b/tests/Makefile.include >> >> @@ -560,8 +560,8 @@ tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y) >> >> tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y) >> >> tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y) >> >> tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o >> >> -tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y) >> >> -tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o >> >> +tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-qom-obj-y) >> >> +tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-qom-obj-y) >> > >> > This doesn't look right to me - $(test-qom-obj-y) is the same as >> > $(test-util-obj-y), but with $(qom-obj-y) added. AFAIK, your >> > warn_report function doesn't use any code from $(qom-obj-y), so >> > we should not need to link to that. So I think there's something >> > else going on here. >> >> The problem I was seeing is that monitor_get_fd() is getting called in >> stubs/monitor.c which then requires error_setg_internal() to be linked >> in. Apparently this doesn't happen without this change as I kept >> seeing linker errors. > > That's bizarre because error_setg_internal is included in libqemuutil.la > that we're already linking to. That's what I thought too, but this is the only solution I could find. I'm open to suggestions, I'm not too familiar with all these linker scripts. Thanks, Alistair > > > Regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| >
diff --git a/tests/Makefile.include b/tests/Makefile.include index 7af278db55..4886caf565 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -560,8 +560,8 @@ tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y) tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y) tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y) tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o -tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y) -tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o +tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-qom-obj-y) +tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-qom-obj-y) tests/test-int128$(EXESUF): tests/test-int128.o tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y) tests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y) diff --git a/util/cutils.c b/util/cutils.c index 1534682083..b33ede83d1 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -30,6 +30,7 @@ #include "qemu/iov.h" #include "net/net.h" #include "qemu/cutils.h" +#include "qemu/error-report.h" void strpadcpy(char *buf, int buf_size, const char *str, char pad) { @@ -601,7 +602,7 @@ int parse_debug_env(const char *name, int max, int initial) return initial; } if (debug < 0 || debug > max || errno != 0) { - fprintf(stderr, "warning: %s not in [0, %d]", name, max); + warn_report("%s not in [0, %d]", name, max); return initial; } return debug;
Convert any remaining uses of fprintf(stderr, "warning:"... to use warn_report() instead. This helps standardise on a single method of printing warnings to the user. All of the warnings were changed using this command: find ./* -type f -exec sed -i 's|fprintf(.*".*warning[,:] |warn_report("|Ig' {} + The #include lines and chagnes to the test Makefile were manually updated to allow the code to compile. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> --- tests/Makefile.include | 4 ++-- util/cutils.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-)