On Fri, Nov 30, 2018 at 11:43:40AM +0100, Thomas Huth wrote: > The questions about our minimum compiler requirement pops up every > couple of months, and we then have to recall the details each time. > So let's document this in a proper way, by adding a comment and > check for the right compiler version to our compiler.h header. > > Signed-off-by: Thomas Huth <th...@redhat.com> > --- > include/qemu/compiler.h | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h > index ca9bc85..775446b 100644 > --- a/include/qemu/compiler.h > +++ b/include/qemu/compiler.h > @@ -22,6 +22,14 @@ > # define QEMU_GNUC_PREREQ(maj, min) 0 > #endif > > +/* > + * We need at least GCC 4.1 for atomics support. Clang also supports these, > + * and reports itself as GCC 4.2, so it passes this check, too. > + */ > +#if !QEMU_GNUC_PREREQ(4, 1) > +#error QEMU needs a compiler that is compatible with GCC v4.1 or newer > +#endif
This encodes our current minimum which is fine as a first step. I think we could reasonably increase our min version now that we have declared explicitly what platforms we intend to support RHEL-7: 4.8.5 Debian (Stretch): 6.3.0 Debian (Jessie): 4.8.4 OpenBSD (ports): 4.9.4 FreeBSD (ports): 8.2.0 OpenSUSE Leap 15: 7.3.1 Ubuntu (Xenial): 5.3.1 macOS (Homebrew): 8.2.0 Arguably we don't care about gcc version for *BSD and macOS since those platforms normally use CLang Anyway, with this info I think we can reasonably pick gcc 4.8.0 We would need an explicit check for clang, however, instead of relying on it claiming gcc 4.2 support - that's a way inaccurate claim anyway so detecting a specific clang version would be better regardless IMHO 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 :|