On Tue, Sep 11, 2012 at 10:52 PM, Eric Blake <ebl...@redhat.com> wrote: > On 09/11/2012 02:31 PM, Blue Swirl wrote: >> On Mon, Sep 10, 2012 at 8:26 AM, Wenchao Xia <xiaw...@linux.vnet.ibm.com> >> wrote: >>> This patch contains type and defines used in APIs, one file for public >>> usage >>> by user, one for libqblock internal usage. >>> > >>> + >>> +#if __GNUC__ >= 4 >> >> #if defined(__GNUC__) && __GNUC__ ... > > Seriously? We require a C99-compliant compiler, which is required to > treat the more compact version identically (all undefined names evaluate > to 0 in the preprocessor), and HACKING doesn't mandate that we spell out > a defined-ness check first. Okay, so configure adds -Wundef to the set > of CFLAGS, but I fail to see why we want -Wundef (that's an > anachronistic warning, only there to help you if you are writing code > portable to K&R).
I don't think we require C99 compliance. Removing -Wundef may have merits of its own even if I fail to see them. Typically a stricter set of warnings is better. But this case is different from other QEMU since this is supposed to be a public header file for a shared library that will be used by projects external to QEMU. We have absolutely no control what compiler flags the user project is using, so we should try to be compatible with any reasonable compilers with any reasonable settings. We could even try to be compatible with C++. The above applies only to these headers. Aiming for compatibility for other compilers for the .c files would make sense if there was a lot of interest to use only the library directly in another project, but let's wait for the interested crowds to show up. > > -- > Eric Blake ebl...@redhat.com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >