[3/6] scanner: Reverse expat/libxml include order

Submitted by Daniel Stone on Aug. 29, 2018, 6:17 a.m.

Details

Message ID 20180829061715.27776-4-daniels@collabora.com
State Accepted
Headers show
Series "Minor test/scanner fixes" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Daniel Stone Aug. 29, 2018, 6:17 a.m.
libxml2 unconditonally defines XMLCALL to nothing. Expat does not
redefine XMLCALL if it is already defined, but if it is not, and we are
building with gcc on i386 (not x86-64), it will define it as 'cdecl'.

Including Expat before libxml thus results in a warning about XMLCALL
being redefined. Luckily we can get around this by just reversing the
include order: cdecl is a no-op on Unix-like systems, so by having
libxml first define XMLCALL to nothing and including Expat afterwards,
we avoid the warning and lose nothing.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 src/scanner.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/scanner.c b/src/scanner.c
index 084f196d..47836f9a 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -35,7 +35,6 @@ 
 #include <string.h>
 #include <errno.h>
 #include <ctype.h>
-#include <expat.h>
 #include <getopt.h>
 #include <limits.h>
 #include <unistd.h>
@@ -48,6 +47,8 @@  extern char DTD_DATA_begin;
 extern int DTD_DATA_len;
 #endif
 
+#include <expat.h>
+
 #include "wayland-util.h"
 
 #define PROGRAM_NAME "wayland-scanner"