summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_platform.h
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2009-12-28 02:22:04 +0000
committerkientzle <kientzle@FreeBSD.org>2009-12-28 02:22:04 +0000
commit49f605d81275e37c87a991547b2e49d62ef9402e (patch)
treea93827ff1c28c6d1fed0476c62408e42bd9d019a /lib/libarchive/archive_platform.h
parent5796104304349d65397f921c41e3969e9c1a6d91 (diff)
downloadFreeBSD-src-49f605d81275e37c87a991547b2e49d62ef9402e.zip
FreeBSD-src-49f605d81275e37c87a991547b2e49d62ef9402e.tar.gz
Portability:
* some non-FreeBSD platforms do actually define __FBSDID() in sys/cdefs.h * Borland C <sigh>
Diffstat (limited to 'lib/libarchive/archive_platform.h')
-rw-r--r--lib/libarchive/archive_platform.h42
1 files changed, 37 insertions, 5 deletions
diff --git a/lib/libarchive/archive_platform.h b/lib/libarchive/archive_platform.h
index dbf5114..9dc4643 100644
--- a/lib/libarchive/archive_platform.h
+++ b/lib/libarchive/archive_platform.h
@@ -25,6 +25,8 @@
* $FreeBSD$
*/
+/* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */
+
/*
* This header is the first thing included in any of the libarchive
* source files. As far as possible, platform-specific issues should
@@ -50,17 +52,27 @@
#error Oops: No config.h and no pre-built configuration in archive_platform.h.
#endif
+/* It should be possible to get rid of this by extending the feature-test
+ * macros to cover Windows API functions, probably along with non-trivial
+ * refactoring of code to find structures that sit more cleanly on top of
+ * either Windows or Posix APIs. */
+#if (defined(__WIN32__) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__)
+#include "archive_windows.h"
+#endif
+
/*
* The config files define a lot of feature macros. The following
* uses those macros to select/define replacements and include key
* headers as required.
*/
-/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
-#ifdef __FreeBSD__
-#include <sys/cdefs.h> /* For __FBSDID */
-#else
-/* Just leaving this macro replacement empty leads to a dangling semicolon. */
+/* Get a real definition for __FBSDID if we can */
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/* If not, define it so as to avoid dangling semicolons. */
+#ifndef __FBSDID
#define __FBSDID(a) struct _undefined_hack
#endif
@@ -72,6 +84,26 @@
#include <stdint.h>
#endif
+/* Borland warns about its own constants! */
+#if defined(__BORLANDC__)
+# if HAVE_DECL_UINT64_MAX
+# undef UINT64_MAX
+# undef HAVE_DECL_UINT64_MAX
+# endif
+# if HAVE_DECL_UINT64_MIN
+# undef UINT64_MIN
+# undef HAVE_DECL_UINT64_MIN
+# endif
+# if HAVE_DECL_INT64_MAX
+# undef INT64_MAX
+# undef HAVE_DECL_INT64_MAX
+# endif
+# if HAVE_DECL_INT64_MIN
+# undef INT64_MIN
+# undef HAVE_DECL_INT64_MIN
+# endif
+#endif
+
/* Some platforms lack the standard *_MAX definitions. */
#if !HAVE_DECL_SIZE_MAX
#define SIZE_MAX (~(size_t)0)
OpenPOWER on IntegriCloud