Reduce differences in pbatard branch for headers. (Still need to add empty array/union differences).

This commit is contained in:
R. Bernstein
2012-03-03 08:48:43 -05:00
parent 730b58a86e
commit 316fb2408f
8 changed files with 213 additions and 117 deletions

View File

@@ -29,37 +29,35 @@
extern "C" {
#endif /* __cplusplus */
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
#define EXTERNAL_LIBCDIO_CONFIG_H
#include <cdio/cdio_config.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
/* provide some C99 definitions */
#if defined(HAVE_SYS_TYPES_H)
/* If <sys/types.h> is not available on your platform please
contact the libcdio mailing list so that we can fix it! */
#if !defined(ARE_THERE_STILL_ENVS_WITHOUT_SYS_TYPES)
#include <sys/types.h>
#endif
#if defined(HAVE_STDINT_H)
# include <stdint.h>
#elif defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#elif defined(AMIGA) || defined(__linux__)
typedef u_int8_t uint8_t;
typedef u_int16_t uint16_t;
typedef u_int32_t uint32_t;
typedef u_int64_t uint64_t;
#if defined(AMIGA)
typedef u_int8_t uint8_t;
typedef u_int16_t uint16_t;
typedef u_int32_t uint32_t;
typedef u_int64_t uint64_t;
#else
/* warning ISO/IEC 9899:1999 <stdint.h> was missing and even <inttypes.h> */
/* fixme */
#endif /* HAVE_STDINT_H */
/* If <stdint.h> is not available on your platform please
contact the libcdio mailing list so that we can fix it!
For MSVC, you can find both a public domain stdint.h and
inttypes.h in the MSVC/missing directory of libcdio. */
#include <stdint.h>
#endif
typedef uint8_t ubyte;
/* MSVC does not define mode_t and ssize_t by default. The way
to compensate for missing UNIX types is to include a custom
unistd.h that defines them. Such a file is provided with
the libcdio source, in the MSVC/missing directory */
#if defined(_MSC_VER)
#include <unistd.h>
#endif
/* default HP/UX macros are broken */
#if defined(__hpux__)
# undef UINT16_C
@@ -106,15 +104,24 @@ typedef uint8_t ubyte;
#endif
#ifndef __cplusplus
# if defined(HAVE_STDBOOL_H)
# include <stdbool.h>
# else
/* ISO/IEC 9899:1999 <stdbool.h> missing -- enabling workaround */
# define false 0
# define true 1
# define bool uint8_t
# endif /*HAVE_STDBOOL_H*/
/* All the stdbool.h seem to define those */
#ifndef __bool_true_false_are_defined
#define __bool_true_false_are_defined 1
#undef bool
#undef true
#undef false
#ifdef _Bool
#define bool _Bool
#else
#define bool int
#endif
#define true 1
#define false 0
#endif /* __bool_true_false_are_defined */
#endif /*C++*/
/* some GCC optimizations -- gcc 2.5+ */
@@ -148,18 +155,21 @@ typedef uint8_t ubyte;
/* for GCC we try to use GNUC_PACKED */
# define PRAGMA_BEGIN_PACKED
# define PRAGMA_END_PACKED
#elif defined(HAVE_ISOC99_PRAGMA)
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
/* should work with most EDG-frontend based compilers */
# define PRAGMA_BEGIN_PACKED _Pragma("pack(1)")
# define PRAGMA_END_PACKED _Pragma("pack()")
#elif defined(_MSC_VER)
# define PRAGMA_BEGIN_PACKED __pragma(pack(push, 1))
# define PRAGMA_END_PACKED __pragma(pack(pop))
#else /* neither gcc nor _Pragma() available... */
/* ...so let's be naive and hope the regression testsuite is run... */
# define PRAGMA_BEGIN_PACKED
# define PRAGMA_END_PACKED
#endif
/**
* user-directed static branch prediction gcc 2.96+
/*
* user directed static branch prediction gcc 2.96+
*/
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
# define GNUC_LIKELY(x) __builtin_expect((x),true)