diff options
Diffstat (limited to 'src/lzo_supp.h')
-rw-r--r-- | src/lzo_supp.h | 127 |
1 files changed, 60 insertions, 67 deletions
diff --git a/src/lzo_supp.h b/src/lzo_supp.h index f7d0351..a2c9021 100644 --- a/src/lzo_supp.h +++ b/src/lzo_supp.h @@ -2,7 +2,7 @@ This file is part of the LZO real-time data compression library. - Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer All Rights Reserved. The LZO library is free software; you can redistribute it and/or @@ -71,12 +71,12 @@ #if (LZO_OS_POSIX) # if (LZO_OS_POSIX_AIX) # define HAVE_SYS_RESOURCE_H 1 -# elif (LZO_OS_POSIX_FREEBSD || LZO_OS_POSIX_MACOSX || LZO_OS_POSIX_NETBSD || LZO_OS_POSIX_OPENBSD) +# elif (LZO_OS_POSIX_DARWIN || LZO_OS_POSIX_FREEBSD || LZO_OS_POSIX_NETBSD || LZO_OS_POSIX_OPENBSD) # define HAVE_STRINGS_H 1 # undef HAVE_MALLOC_H # elif (LZO_OS_POSIX_HPUX || LZO_OS_POSIX_INTERIX) # define HAVE_ALLOCA_H 1 -# elif (LZO_OS_POSIX_MACOSX && LZO_LIBC_MSL) +# elif (LZO_OS_POSIX_DARWIN && LZO_LIBC_MSL) # undef HAVE_SYS_TIME_H # undef HAVE_SYS_TYPES_H # elif (LZO_OS_POSIX_SOLARIS || LZO_OS_POSIX_SUNOS) @@ -154,7 +154,7 @@ # undef HAVE_UTIME_H # undef HAVE_SYS_TIME_H # define HAVE_SYS_UTIME_H 1 -#elif (LZO_CC_GHS || LZO_CC_INTELC || LZO_CC_MSC) +#elif (LZO_CC_CLANG_C2 || LZO_CC_CLANG_MSC || LZO_CC_GHS || LZO_CC_INTELC_MSC || LZO_CC_MSC) # undef HAVE_DIRENT_H # undef HAVE_UNISTD_H # undef HAVE_UTIME_H @@ -352,7 +352,7 @@ #if (LZO_OS_POSIX) # if (LZO_OS_POSIX_AIX) # define HAVE_GETRUSAGE 1 -# elif (LZO_OS_POSIX_MACOSX && LZO_LIBC_MSL) +# elif (LZO_OS_POSIX_DARWIN && LZO_LIBC_MSL) # undef HAVE_CHOWN # undef HAVE_LSTAT # elif (LZO_OS_POSIX_UNICOS) @@ -448,7 +448,7 @@ #elif (LZO_CC_IBMC) # undef HAVE_SNPRINTF # undef HAVE_VSNPRINTF -#elif (LZO_CC_INTELC) +#elif (LZO_CC_CLANG_MSC || LZO_CC_INTELC_MSC) # ifndef snprintf # define snprintf _snprintf # endif @@ -457,7 +457,7 @@ # endif #elif (LZO_CC_LCCWIN32) # define utime _utime -#elif (LZO_CC_MSC) +#elif (LZO_CC_CLANG_C2 || LZO_CC_MSC) # if (_MSC_VER < 600) # undef HAVE_STRFTIME # endif @@ -471,7 +471,7 @@ # ifndef vsnprintf # define vsnprintf _vsnprintf # endif -# else +# elif (_MSC_VER < 1900) # ifndef snprintf # define snprintf _snprintf # endif @@ -656,8 +656,6 @@ extern "C" { #endif #if (LZO_BROKEN_CDECL_ALT_SYNTAX) typedef void __lzo_cdecl_sighandler (*lzo_sighandler_t)(lzo_signo_t); -#elif defined(RETSIGTYPE) -typedef RETSIGTYPE (__lzo_cdecl_sighandler *lzo_sighandler_t)(lzo_signo_t); #else typedef void (__lzo_cdecl_sighandler *lzo_sighandler_t)(lzo_signo_t); #endif @@ -812,7 +810,7 @@ typedef unsigned short wchar_t; #if (HAVE_SIGNAL_H) # include <signal.h> #endif -#if (TIME_WITH_SYS_TIME) +#if (HAVE_SYS_TIME_H && HAVE_TIME_H) # include <sys/time.h> # include <time.h> #elif (HAVE_TIME_H) @@ -1513,34 +1511,33 @@ LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * a # endif #endif LZOCHK_ASSERT(1 == 1) - LZOCHK_ASSERT(__LZO_MASK_GEN(1u,1) == 1) - LZOCHK_ASSERT(__LZO_MASK_GEN(1u,2) == 3) - LZOCHK_ASSERT(__LZO_MASK_GEN(1u,3) == 7) - LZOCHK_ASSERT(__LZO_MASK_GEN(1u,8) == 255) -#if (SIZEOF_INT >= 2) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,1) == 1u) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,2) == 3u) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,3) == 7u) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,8) == 255u) +#if (LZO_SIZEOF_INT >= 2) LZOCHK_ASSERT(__LZO_MASK_GEN(1,15) == 32767) LZOCHK_ASSERT(__LZO_MASK_GEN(1u,16) == 0xffffU) LZOCHK_ASSERT(__LZO_MASK_GEN(0u,16) == 0u) -#else +#endif LZOCHK_ASSERT(__LZO_MASK_GEN(1ul,16) == 0xffffUL) LZOCHK_ASSERT(__LZO_MASK_GEN(0ul,16) == 0ul) -#endif -#if (SIZEOF_INT >= 4) +#if (LZO_SIZEOF_INT >= 4) LZOCHK_ASSERT(__LZO_MASK_GEN(1,31) == 2147483647) LZOCHK_ASSERT(__LZO_MASK_GEN(1u,32) == 0xffffffffU) LZOCHK_ASSERT(__LZO_MASK_GEN(0u,32) == 0u) #endif -#if (SIZEOF_LONG >= 4) +#if (LZO_SIZEOF_LONG >= 4) LZOCHK_ASSERT(__LZO_MASK_GEN(1ul,32) == 0xffffffffUL) LZOCHK_ASSERT(__LZO_MASK_GEN(0ul,32) == 0ul) #endif -#if (SIZEOF_LONG >= 8) +#if (LZO_SIZEOF_LONG >= 8) LZOCHK_ASSERT(__LZO_MASK_GEN(1ul,64) == 0xffffffffffffffffUL) LZOCHK_ASSERT(__LZO_MASK_GEN(0ul,64) == 0ul) #endif #if !(LZO_BROKEN_INTEGRAL_PROMOTION) - LZOCHK_ASSERT(__LZO_MASK_GEN(1u,SIZEOF_INT*8) == ~0u) - LZOCHK_ASSERT(__LZO_MASK_GEN(1ul,SIZEOF_LONG*8) == ~0ul) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,LZO_SIZEOF_INT*8) == ~0u) + LZOCHK_ASSERT(__LZO_MASK_GEN(1ul,LZO_SIZEOF_LONG*8) == ~0ul) #endif #if 1 LZOCHK_ASSERT(__LZO_MASK_GEN(0,0) == 0) @@ -1575,10 +1572,10 @@ LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * a LZOCHK_ASSERT((~0ul & ~0) == ~0ul) LZOCHK_ASSERT((~0ul & ~0u) == ~0u) #if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0150) -#elif (SIZEOF_INT == 2) +#elif (LZO_SIZEOF_INT == 2) LZOCHK_ASSERT((~0l & ~0u) == 0xffffU) LZOCHK_ASSERT((~0ul & ~0u) == 0xffffU) -#elif (SIZEOF_INT == 4) +#elif (LZO_SIZEOF_INT == 4) LZOCHK_ASSERT((~0l & ~0u) == 0xffffffffU) LZOCHK_ASSERT((~0ul & ~0u) == 0xffffffffU) #endif @@ -1626,8 +1623,8 @@ LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * a #else LZOCHK_ASSERT(sizeof(short) == sizeof(LZO_STATIC_CAST(short, 0))) #endif -#if (SIZEOF_SHORT > 0) - LZOCHK_ASSERT(sizeof(short) == SIZEOF_SHORT) +#if (LZO_SIZEOF_SHORT > 0) + LZOCHK_ASSERT(sizeof(short) == LZO_SIZEOF_SHORT) #endif LZOCHK_ASSERT_IS_SIGNED_T(int) LZOCHK_ASSERT_IS_UNSIGNED_T(unsigned int) @@ -1638,8 +1635,8 @@ LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * a LZOCHK_ASSERT(sizeof(int) >= sizeof(short)) LZOCHK_ASSERT(sizeof(int) == sizeof(0)) LZOCHK_ASSERT(sizeof(int) == sizeof(LZO_STATIC_CAST(int, 0))) -#if (SIZEOF_INT > 0) - LZOCHK_ASSERT(sizeof(int) == SIZEOF_INT) +#if (LZO_SIZEOF_INT > 0) + LZOCHK_ASSERT(sizeof(int) == LZO_SIZEOF_INT) #endif LZOCHK_ASSERT(sizeof(0) == sizeof(int)) LZOCHK_ASSERT_IS_SIGNED_T(long) @@ -1651,15 +1648,15 @@ LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * a LZOCHK_ASSERT(sizeof(long) >= sizeof(int)) LZOCHK_ASSERT(sizeof(long) == sizeof(0L)) LZOCHK_ASSERT(sizeof(long) == sizeof(LZO_STATIC_CAST(long, 0))) -#if (SIZEOF_LONG > 0) - LZOCHK_ASSERT(sizeof(long) == SIZEOF_LONG) +#if (LZO_SIZEOF_LONG > 0) + LZOCHK_ASSERT(sizeof(long) == LZO_SIZEOF_LONG) #endif LZOCHK_ASSERT(sizeof(0L) == sizeof(long)) LZOCHK_ASSERT_IS_UNSIGNED_T(size_t) LZOCHK_ASSERT(sizeof(size_t) >= sizeof(int)) LZOCHK_ASSERT(sizeof(size_t) == sizeof(sizeof(0))) -#if (SIZEOF_SIZE_T > 0) - LZOCHK_ASSERT(sizeof(size_t) == SIZEOF_SIZE_T) +#if (LZO_SIZEOF_SIZE_T > 0) + LZOCHK_ASSERT(sizeof(size_t) == LZO_SIZEOF_SIZE_T) #endif LZOCHK_ASSERT_IS_SIGNED_T(ptrdiff_t) LZOCHK_ASSERT(sizeof(ptrdiff_t) >= sizeof(int)) @@ -1670,13 +1667,13 @@ LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * a LZOCHK_ASSERT(4 == sizeof(LZO_STATIC_CAST(char __huge*, 0) - LZO_STATIC_CAST(char __huge*, 0))) # endif #endif -#if (SIZEOF_PTRDIFF_T > 0) - LZOCHK_ASSERT(sizeof(ptrdiff_t) == SIZEOF_PTRDIFF_T) +#if (LZO_SIZEOF_PTRDIFF_T > 0) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == LZO_SIZEOF_PTRDIFF_T) #endif LZOCHK_ASSERT(sizeof(void*) >= sizeof(char*)) -#if (SIZEOF_VOID_P > 0) - LZOCHK_ASSERT(sizeof(void*) == SIZEOF_VOID_P) - LZOCHK_ASSERT(sizeof(char*) == SIZEOF_VOID_P) +#if (LZO_SIZEOF_VOID_P > 0) + LZOCHK_ASSERT(sizeof(void*) == LZO_SIZEOF_VOID_P) + LZOCHK_ASSERT(sizeof(char*) == LZO_SIZEOF_VOID_P) #endif #if (LZO_HAVE_MM_HUGE_PTR) LZOCHK_ASSERT(4 == sizeof(void __huge*)) @@ -1692,14 +1689,14 @@ LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * a #if defined(LZOCHK_CFG_PEDANTIC) #if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0150) #else - LZOCHK_ASSERT((1 << (8*SIZEOF_INT-1)) < 0) + LZOCHK_ASSERT((1 << (8*LZO_SIZEOF_INT-1)) < 0) #endif #endif - LZOCHK_ASSERT((1u << (8*SIZEOF_INT-1)) > 0) + LZOCHK_ASSERT((1u << (8*LZO_SIZEOF_INT-1)) > 0) #if defined(LZOCHK_CFG_PEDANTIC) - LZOCHK_ASSERT((1l << (8*SIZEOF_LONG-1)) < 0) + LZOCHK_ASSERT((1l << (8*LZO_SIZEOF_LONG-1)) < 0) #endif - LZOCHK_ASSERT((1ul << (8*SIZEOF_LONG-1)) > 0) + LZOCHK_ASSERT((1ul << (8*LZO_SIZEOF_LONG-1)) > 0) #if defined(lzo_int16e_t) LZOCHK_ASSERT(sizeof(lzo_int16e_t) == 2) LZOCHK_ASSERT(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T) @@ -1852,13 +1849,13 @@ LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * a LZOCHK_ASSERT((LZO_UINT64_C(0xffffffffffffffff) >> 63) == 1) LZOCHK_ASSERT((LZO_UINT64_C(0xffffffffffffffff) & ~0) == LZO_UINT64_C(0xffffffffffffffff)) LZOCHK_ASSERT((LZO_UINT64_C(0xffffffffffffffff) & ~0l) == LZO_UINT64_C(0xffffffffffffffff)) -#if (SIZEOF_INT == 4) +#if (LZO_SIZEOF_INT == 4) # if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) # else LZOCHK_ASSERT((LZO_UINT64_C(0xffffffffffffffff) & (~0u+0u)) == 0xffffffffu) # endif #endif -#if (SIZEOF_LONG == 4) +#if (LZO_SIZEOF_LONG == 4) # if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) # else LZOCHK_ASSERT((LZO_UINT64_C(0xffffffffffffffff) & (~0ul+0ul)) == 0xfffffffful) @@ -1922,6 +1919,14 @@ LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * a LZOCHK_ASSERT(sizeof(size_t) == sizeof(void*)) LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) #endif +#if (LZO_ABI_IP32W64) + LZOCHK_ASSERT(sizeof(int) == 4) + LZOCHK_ASSERT(sizeof(void*) == 4) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(size_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) + LZOCHK_ASSERT(LZO_WORDSIZE == 8) +#endif #if (LZO_ARCH_I086) LZOCHK_ASSERT(sizeof(size_t) == 2) LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) @@ -1940,13 +1945,13 @@ LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * a LZOCHK_ASSERT(sizeof(void (*)(void)) == 8) #endif #if (LZO_CC_NDPC) -#elif (SIZEOF_INT > 1) +#elif (LZO_SIZEOF_INT > 1) LZOCHK_ASSERT( LZO_STATIC_CAST(int, LZO_STATIC_CAST(unsigned char, LZO_STATIC_CAST(signed char, -1))) == 255) #endif #if defined(LZOCHK_CFG_PEDANTIC) #if (LZO_CC_KEILC) #elif (LZO_CC_NDPC) -#elif !(LZO_BROKEN_INTEGRAL_PROMOTION) && (SIZEOF_INT > 1) +#elif !(LZO_BROKEN_INTEGRAL_PROMOTION) && (LZO_SIZEOF_INT > 1) LZOCHK_ASSERT( ((LZO_STATIC_CAST(unsigned char, 128)) << LZO_STATIC_CAST(int, (8*sizeof(int)-8))) < 0) #endif #endif @@ -2537,7 +2542,7 @@ LZOLIB_PUBLIC(int, lzo_getopt) (lzo_getopt_p g, if (!s || s[1] != ':') { if (!a[0]) - ++g->optind, g->shortpos = 0; + { ++g->optind; g->shortpos = 0; } if (!s) { g->optopt = c; @@ -2546,7 +2551,7 @@ LZOLIB_PUBLIC(int, lzo_getopt) (lzo_getopt_p g, } else { - ++g->optind, g->shortpos = 0; + ++g->optind; g->shortpos = 0; if (a[0]) g->optarg = a; else if (s[2] != ':') @@ -2656,7 +2661,7 @@ LZOLIB_PUBLIC(lzo_hvoid_p, lzo_halloc) (lzo_hsize_t size) p = lmalloc(size); #else if (size < LZO_STATIC_CAST(size_t, -1)) - p = malloc((size_t) size); + p = malloc(LZO_STATIC_CAST(size_t, size)); #endif } #endif @@ -2866,25 +2871,25 @@ LZOLIB_PUBLIC(long, lzo_safe_hwrite) (int fd, const lzo_hvoid_p buf, long size) #if !defined(LZOLIB_PUBLIC) # define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) #endif -#if 1 && (LZO_OS_POSIX_LINUX && LZO_ARCH_AMD64 && LZO_ASM_SYNTAX_GNUC) +#if 1 && (LZO_OS_POSIX_LINUX && LZO_ARCH_AMD64 && LZO_ASM_SYNTAX_GNUC && !LZO_CFG_NO_SYSCALL) #ifndef lzo_pclock_syscall_clock_gettime #define lzo_pclock_syscall_clock_gettime lzo_pclock_syscall_clock_gettime #endif __lzo_static_noinline long lzo_pclock_syscall_clock_gettime(long clockid, struct timespec *ts) { unsigned long r = 228; - __asm__ __volatile__("syscall\n" : "=a" (r) : "0" (r), "D" (clockid), "S" (ts) __LZO_ASM_CLOBBER_LIST_CC_MEMORY); + __asm__ __volatile__("syscall\n" : "=a" (r), "=m" (*ts) : "0" (r), "D" (clockid), "S" (ts) __LZO_ASM_CLOBBER_LIST_CC); return LZO_ICAST(long, r); } #endif -#if 1 && (LZO_OS_POSIX_LINUX && LZO_ARCH_I386 && LZO_ASM_SYNTAX_GNUC) && defined(lzo_int64l_t) +#if 1 && (LZO_OS_POSIX_LINUX && LZO_ARCH_I386 && LZO_ASM_SYNTAX_GNUC && !LZO_CFG_NO_SYSCALL) && defined(lzo_int64l_t) #ifndef lzo_pclock_syscall_clock_gettime #define lzo_pclock_syscall_clock_gettime lzo_pclock_syscall_clock_gettime #endif __lzo_static_noinline long lzo_pclock_syscall_clock_gettime(long clockid, struct timespec *ts) { unsigned long r = 265; - __asm__ __volatile__("pushl %%ebx\n pushl %%edx\n popl %%ebx\n int $0x80\n popl %%ebx\n" : "=a" (r) : "0" (r), "d" (clockid), "c" (ts) __LZO_ASM_CLOBBER_LIST_CC_MEMORY); + __asm__ __volatile__("pushl %%ebx\n pushl %%edx\n popl %%ebx\n int $0x80\n popl %%ebx\n": "=a" (r), "=m" (*ts) : "0" (r), "d" (clockid), "c" (ts) __LZO_ASM_CLOBBER_LIST_CC); return LZO_ICAST(long, r); } #endif @@ -3283,14 +3288,6 @@ LZOLIB_PUBLIC(int, lzo_pclock_flush_cpu_cache) (lzo_pclock_handle_p h, unsigned LZO_UNUSED(h); LZO_UNUSED(flags); return -1; } -#if defined(__LZOLIB_PCLOCK_NEED_WARN_POP) -# if (LZO_CC_MSC && (_MSC_VER >= 1200)) -# pragma warning(pop) -# else -# error "__LZOLIB_PCLOCK_NEED_WARN_POP" -# endif -# undef __LZOLIB_PCLOCK_NEED_WARN_POP -#endif #endif #if defined(LZO_WANT_ACCLIB_MISC) # undef LZO_WANT_ACCLIB_MISC @@ -3510,11 +3507,6 @@ LZOLIB_PUBLIC(lzo_uint32e_t, lzo_muldiv32u) (lzo_uint32e_t a, lzo_uint32e_t b, l return r; } #endif -#if 0 -LZOLIB_PUBLIC_NOINLINE(int, lzo_syscall_clock_gettime) (int c) -{ -} -#endif #if (LZO_OS_WIN16) LZO_EXTERN_C void __far __pascal DebugBreak(void); #endif @@ -3642,7 +3634,8 @@ LZO_EXTERN_C int __lzo_cdecl _setargv(void) { return __setargv(); } #endif #endif #if (LZO_OS_WIN32 || LZO_OS_WIN64) -#if (LZO_CC_INTELC || LZO_CC_MSC) +#if (LZO_CC_MSC && (_MSC_VER >= 1900)) +#elif (LZO_CC_INTELC || LZO_CC_MSC) LZO_EXTERN_C int __lzo_cdecl __setargv(void); LZO_EXTERN_C int __lzo_cdecl _setargv(void); LZO_EXTERN_C int __lzo_cdecl _setargv(void) { return __setargv(); } |