Portability:

* some non-FreeBSD platforms do actually define __FBSDID() in sys/cdefs.h
 * Borland C <sigh>
This commit is contained in:
Tim Kientzle 2009-12-28 02:22:04 +00:00
parent e9cb23e15d
commit a5a14ed059
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=201090

View File

@ -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)