git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Include xmlparse.h instead of expat.h on QNX

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 11, 2013, 21:34 UTC
Message-ID
<7vip5ylekj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1360616395-18912-1-git-send-email-kraai@ftbfs.org>
Matt Kraai <kraai@ftbfs.org> writes:
Show 7 quoted lines
> From: Matt Kraai <matt.kraai@amo.abbott.com>
>
> QNX 6.3.2 through 6.5.0 include Expat 1.1, which provides xmlparse.h
> instead of expat.h, so include the former on QNX systems.
>
> Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com>
> ---
Two points and a possibly irrelevant half:
 - If a fix is platform specific (i.e. tempts to use #ifdef
   PLATFORM_NAME), we would prefer to see a patch that that is
   isolated to platform-specific compatibility layer, which would
   involve:
   . add compat/qnx/expat.h file that #include <xmlparse.h>
   . to Makefile, add -Icompat/qnx/ to CFLAGS
 - Is this really a fix for a problem specific to QNX?  It looks
   like this is for any platform with expat 1, no?
 - What happens to people with QNX older than 6.3.2 or newer than
   6.5.0 (assuming they will eventually start shipping expat 2) with
   your patch?

Assuming that this change is about building with expat1, it would probably be better to do something like this instead, I would think.

 Makefile         | 5 +++++
 config.mak.uname | 1 +
 http-push.c      | 4 ++++
 3 files changed, 10 insertions(+)
diff --git a/Makefile b/Makefile
index 5a2e02d..57032cc 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,8 @@ all::
 # Define EXPATDIR=/foo/bar if your expat header and library files are in
 # /foo/bar/include and /foo/bar/lib directories.
 #
+# Define EXPAT_VERSION=1 if you are trying to build with expat 1.x (e.g. QNX).
+#
 # Define NO_GETTEXT if you don't want Git output to be translated.
 # A translated Git requires GNU libintl or another gettext implementation,
 # plus libintl-perl at runtime.
@@ -1089,6 +1091,9 @@ else
 		else
 			EXPAT_LIBEXPAT = -lexpat
 		endif
+		ifdef EXPAT_VERSION
+		BASIC_CFLAGS += -DEXPAT_VERSION=$(EXPAT_VERSION)
+		endif
 	endif
 endif
 
diff --git a/config.mak.uname b/config.mak.uname
index bea34f0..281d834 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -536,4 +536,5 @@ ifeq ($(uname_S),QNX)
 	NO_R_TO_GCC_LINKER = YesPlease
 	NO_STRCASESTR = YesPlease
 	NO_STRLCPY = YesPlease
+	EXPAT_VERSION = 1
 endif
diff --git a/http-push.c b/http-push.c
index 3e72e84..2fdb0cd 100644
--- a/http-push.c
+++ b/http-push.c
@@ -11,7 +11,11 @@
 #include "list-objects.h"
 #include "sigchain.h"
 
+#if EXPAT_VERSION == 1
+#include <xmlparse.h>
+#else
 #include <expat.h>
+#endif
 
 static const char http_push_usage[] =
 "git http-push [--all] [--dry-run] [--force] [--verbose] <remote> [<head>...]\n";
Previous: Junio C HamanoNext: Matt Kraai
Message 9 of 11 in “Include xmlparse.h instead of expat.h on QNX”
  1. Include xmlparse.h instead of expat.h on QNXMatt Kraai, Feb 11, 2013
  2. Jeff KingFeb 11, 2013
  3. Matt KraaiFeb 11, 2013
  4. Allow building with xmlparse.hMatt Kraai, Feb 11, 2013
  5. Junio C HamanoFeb 11, 2013
  6. Allow building with xmlparse.hMatt Kraai, Feb 11, 2013
  7. Junio C HamanoFeb 11, 2013
  8. Junio C HamanoFeb 11, 2013
  9. Junio C HamanoFeb 11, 2013
  10. Matt KraaiFeb 11, 2013
  11. Junio C HamanoFeb 11, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.