]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
build: work with older libnl1 headers
authorEric Blake <eblake@redhat.com>
Mon, 27 Aug 2012 21:00:59 +0000 (15:00 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 27 Aug 2012 21:08:25 +0000 (15:08 -0600)
Ubuntu 10.04 shipped with out-of-the-box libnl1 headers, which
assumed the old gcc semantics of 'extern inline' as a C89 extension:
the function will _always_ be inline if it is used, and that
it may be declared extern inline in headers without a definition,
as long as the definition occurs before any use.  But when C99
added 'extern inline' as a mandatory feature of the language, with
slightly different semantics than gcc (the function MUST have
external linkage, and the inline definition MUST be present
alongside any declaration, where the compiler can then choose
which of the two versions to use), this rendered the use of
'inline' in libnl's header obsolete.  Most distros already solved
this by removing 'inline' (the resulting 'extern' is correct,
regardless of gcc semantics), and libnl-3 does not have the
problem (where it has switched to 'static inline' instead, again
with the definition present, and again, our hack will result in
plain 'static' with no ill effects).  But for the case of building
out of the box, we hack around the broken Ubuntu header.

* src/util/virnetlink.h: Work around libnl issue.

src/util/virnetlink.h

index 1982dae5b1549361696367133975f790a0c5d3d1..82154de08a2e18ab7504769783dfb2428ad5bff7 100644 (file)
 
 # if defined(__linux__) && defined(HAVE_LIBNL)
 
+/* Work around a bug where older libnl-1 headers expected older gcc
+ * semantics of 'extern inline' that conflict with C99 semantics.  */
+#  define inline
 #  include <netlink/msg.h>
+#  undef inline
 
 # else