Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Dec 2009 02:22:05 +0000 (UTC)
From:      Tim Kientzle <kientzle@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r201090 - head/lib/libarchive
Message-ID:  <200912280222.nBS2M5X9075681@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kientzle
Date: Mon Dec 28 02:22:04 2009
New Revision: 201090
URL: http://svn.freebsd.org/changeset/base/201090

Log:
  Portability:
   * some non-FreeBSD platforms do actually define __FBSDID() in sys/cdefs.h
   * Borland C <sigh>

Modified:
  head/lib/libarchive/archive_platform.h

Modified: head/lib/libarchive/archive_platform.h
==============================================================================
--- head/lib/libarchive/archive_platform.h	Mon Dec 28 02:20:23 2009	(r201089)
+++ head/lib/libarchive/archive_platform.h	Mon Dec 28 02:22:04 2009	(r201090)
@@ -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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912280222.nBS2M5X9075681>