On 2 March 2018 at 14:05, Eric Blake <ebl...@redhat.com> wrote: > On 03/02/2018 06:38 AM, Peter Maydell wrote: >> This produces a huge pile of warnings from my OSX toolchain. >> >> When running ar on libqemuutil.a: >> AR libqemuutil.a >> >> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: >> file: libqemuutil.a(qapi-types.o) has no symbols > > > Part of this change was moving the location of the generated ./qapi-types.c > to qapi/qapi-types.c. Could it be that you are doing an incremental build, > rather than a clean build, and the compiler is picking up the stale version > of the file rather than its new location?
I am doing an incremental build, yes. That needs to work, not break... >> I had a look at the autogenerated .c files on my Linux build, and they >> seem to consist only of a bunch of #includes. Why are we not generating >> any code here? > But I just checked, and at least for qapi/qapi-types.c, the generated file > IS just a list of includes; and in fact, it looks like all of the mentioned > files are in that boat (for example, qapi/transaction.json has no events, so > qapi/qapi-events-transaction.c being empty makes sense). > I know that some compilers are picky about that. Yes, I think this is what is causing the problem. > Is a typedef enough to > cause the compiler to have something to compile without warnings? Given that the warnings are coming from nm and ranlib, anything that doesn't actually cause a symbol to be put into the .o file isn't going to be enough I suspect. > If so, > does this patch solve things? If it does, I'll squash it in the right place > within the series and submit a v3 pull request. > > diff --git i/scripts/qapi/common.py w/scripts/qapi/common.py > index 077e0fde4f4..aed32646c00 100644 > --- i/scripts/qapi/common.py > +++ w/scripts/qapi/common.py > @@ -2035,6 +2035,13 @@ class QAPIGenC(QAPIGen): > ''', > blurb=self._blurb, copyright=self._copyright) > > + def _bottom(self, fname): > + return mcgen(''' > +/* Dummy typedef to prevent empty .o file */ > +typedef int %(name)s; > +''', > + name=c_name(fname)) > + > > class QAPIGenH(QAPIGenC): I just tested this, and it isn't sufficient. thanks -- PMM