1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Cleanups.

committer: mfx <mfx> 1090594763 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2004-07-23 14:59:23 +00:00
parent 14ced962db
commit ed9057ca83
4 changed files with 97 additions and 144 deletions

View File

@ -83,4 +83,6 @@ include $(srcdir)/Makefile.bld
include $(srcdir)/Makedefs.dep include $(srcdir)/Makedefs.dep
$(OBJECTS): miniacc.h
# vi:nowrap # vi:nowrap

View File

@ -93,8 +93,8 @@ inline void set_be32(void *bb, unsigned v)
inline unsigned get_le16(const void *bb) inline unsigned get_le16(const void *bb)
{ {
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32) #if defined(ACC_GET_LE16)
return * (const unsigned short *) bb; return ACC_GET_LE16(bb);
#else #else
const unsigned char* b = (const unsigned char*) bb; const unsigned char* b = (const unsigned char*) bb;
unsigned v; unsigned v;
@ -106,8 +106,8 @@ inline unsigned get_le16(const void *bb)
inline void set_le16(void *bb, unsigned v) inline void set_le16(void *bb, unsigned v)
{ {
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32) #if defined(ACC_SET_LE16)
(* (unsigned short *) bb) = (unsigned short) (v & 0xffff); ACC_SET_LE16(bb, v);
#else #else
unsigned char* b = (unsigned char*) bb; unsigned char* b = (unsigned char*) bb;
b[0] = (unsigned char) (v >> 0); b[0] = (unsigned char) (v >> 0);
@ -137,8 +137,8 @@ inline void set_le24(void *bb, unsigned v)
inline unsigned get_le32(const void *bb) inline unsigned get_le32(const void *bb)
{ {
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32) #if defined(ACC_GET_LE32)
return * (const acc_uint32e_t *) bb; return ACC_GET_LE32(bb);
#else #else
const unsigned char* b = (const unsigned char*) bb; const unsigned char* b = (const unsigned char*) bb;
unsigned v; unsigned v;
@ -152,8 +152,8 @@ inline unsigned get_le32(const void *bb)
inline void set_le32(void *bb, unsigned v) inline void set_le32(void *bb, unsigned v)
{ {
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32) #if defined(ACC_SET_LE32)
(* (acc_uint32e_t *) bb) = v; ACC_SET_LE32(bb, v);
#else #else
unsigned char* b = (unsigned char*) bb; unsigned char* b = (unsigned char*) bb;
b[0] = (unsigned char) (v >> 0); b[0] = (unsigned char) (v >> 0);

View File

@ -1028,14 +1028,17 @@ static void first_options(int argc, char **argv)
// assert a sane architecture and compiler // assert a sane architecture and compiler
**************************************************************************/ **************************************************************************/
#define ACC_WANT_ACC_CHK_CH 1
#undef ACCCHK_ASSERT
#include "miniacc.h"
void upx_sanity_check(void) void upx_sanity_check(void)
{ {
#define ACC_WANT_ACC_CHK_CH 1
#undef ACCCHK_ASSERT #undef ACCCHK_ASSERT
#define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr) #define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr)
#include "miniacc.h" #include "miniacc.h"
#undef ACC_WANT_ACC_CHK_CH
#undef ACCCHK_ASSERT #undef ACCCHK_ASSERT
#undef ACC_WANT_ACC_CHK_CH
COMPILE_TIME_ASSERT(sizeof(char) == 1) COMPILE_TIME_ASSERT(sizeof(char) == 1)
COMPILE_TIME_ASSERT(sizeof(short) == 2) COMPILE_TIME_ASSERT(sizeof(short) == 2)

View File

@ -1,5 +1,7 @@
/* ACC -- Automatic Compiler Configuration /* ACC -- Automatic Compiler Configuration
This file is part of the UPX executable compressor.
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
@ -11,9 +13,20 @@
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved. All Rights Reserved.
This software is a copyrighted work licensed under the terms of UPX and the UCL library are free software; you can redistribute them
the GNU General Public License. Please consult the file "COPYING" and/or modify them under the terms of the GNU General Public License as
for details. published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Markus F.X.J. Oberhumer
<markus@oberhumer.com> <markus@oberhumer.com>
@ -22,7 +35,7 @@
#ifndef __ACC_H_INCLUDED #ifndef __ACC_H_INCLUDED
#define __ACC_H_INCLUDED 1 #define __ACC_H_INCLUDED 1
#define ACC_VERSION 20040722L #define ACC_VERSION 20040723L
#if !defined(ACC_CONFIG_INCLUDE) #if !defined(ACC_CONFIG_INCLUDE)
# define ACC_CONFIG_INCLUDE(file) file # define ACC_CONFIG_INCLUDE(file) file
#endif #endif
@ -713,6 +726,11 @@ extern "C" {
#else #else
# error "unknown memory model" # error "unknown memory model"
#endif #endif
#if (ACC_CC_GNUC >= 0x020800ul)
# define __acc_gnuc_extension__ __extension__
#else
# define __acc_gnuc_extension__
#endif
#if (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_PGI) #if (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_PGI)
# define acc_alignof(e) __alignof__(e) # define acc_alignof(e) __alignof__(e)
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 700)) #elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 700))
@ -833,6 +851,66 @@ extern "C" {
# error "check your compiler installation: ULONG_MAX" # error "check your compiler installation: ULONG_MAX"
# endif # endif
#endif #endif
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC)
# elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
# define __acc_cdecl __cdecl
# define __acc_cdecl_atexit
# define __acc_cdecl_main __cdecl
# if (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
# define __acc_cdecl_qsort __pascal
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
# define __acc_cdecl_qsort _stdcall
# else
# define __acc_cdecl_qsort __cdecl
# endif
# elif (ACC_CC_WATCOMC)
# define __acc_cdecl __cdecl
# else
# define __acc_cdecl __cdecl
# define __acc_cdecl_atexit __cdecl
# define __acc_cdecl_main __cdecl
# define __acc_cdecl_qsort __cdecl
# endif
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC || ACC_CC_WATCOMC)
# elif (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
# define __acc_cdecl_sighandler __pascal
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
# define __acc_cdecl_sighandler _stdcall
# elif (ACC_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE)
# define __acc_cdecl_sighandler __clrcall
# elif (ACC_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700))
# if defined(_DLL)
# define __acc_cdecl_sighandler _far _cdecl _loadds
# elif defined(_MT)
# define __acc_cdecl_sighandler _far _cdecl
# else
# define __acc_cdecl_sighandler _cdecl
# endif
# else
# define __acc_cdecl_sighandler __cdecl
# endif
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
# define __acc_cdecl cdecl
#endif
#if !defined(__acc_cdecl)
# define __acc_cdecl
#endif
#if !defined(__acc_cdecl_atexit)
# define __acc_cdecl_atexit
#endif
#if !defined(__acc_cdecl_main)
# define __acc_cdecl_main
#endif
#if !defined(__acc_cdecl_qsort)
# define __acc_cdecl_qsort
#endif
#if !defined(__acc_cdecl_sighandler)
# define __acc_cdecl_sighandler
#endif
#if !defined(__acc_cdecl_va)
# define __acc_cdecl_va __acc_cdecl
#endif
#if (ACC_OS_CYGWIN || (ACC_OS_EMX && defined(__RSXNT__)) || ACC_OS_WIN32 || ACC_OS_WIN64) #if (ACC_OS_CYGWIN || (ACC_OS_EMX && defined(__RSXNT__)) || ACC_OS_WIN32 || ACC_OS_WIN64)
# if (ACC_CC_WATCOMC && (__WATCOMC__ < 1000)) # if (ACC_CC_WATCOMC && (__WATCOMC__ < 1000))
# elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__) # elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
@ -1412,11 +1490,6 @@ extern "C" {
#endif #endif
#if defined(ACC_CONFIG_NO_TYPE) #if defined(ACC_CONFIG_NO_TYPE)
#else #else
#if (ACC_CC_GNUC >= 0x020800ul)
# define __acc_gnuc_extension__ __extension__
#else
# define __acc_gnuc_extension__
#endif
#if (SIZEOF_LONG_LONG > 0) #if (SIZEOF_LONG_LONG > 0)
__acc_gnuc_extension__ typedef long long acc_llong_t; __acc_gnuc_extension__ typedef long long acc_llong_t;
#endif #endif
@ -1606,66 +1679,6 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
# error "integral constants" # error "integral constants"
# endif # endif
#endif #endif
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC)
# elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
# define __acc_cdecl __cdecl
# define __acc_cdecl_atexit
# define __acc_cdecl_main __cdecl
# if (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
# define __acc_cdecl_qsort __pascal
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
# define __acc_cdecl_qsort _stdcall
# else
# define __acc_cdecl_qsort __cdecl
# endif
# elif (ACC_CC_WATCOMC)
# define __acc_cdecl __cdecl
# else
# define __acc_cdecl __cdecl
# define __acc_cdecl_atexit __cdecl
# define __acc_cdecl_main __cdecl
# define __acc_cdecl_qsort __cdecl
# endif
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC || ACC_CC_WATCOMC)
# elif (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
# define __acc_cdecl_sighandler __pascal
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
# define __acc_cdecl_sighandler _stdcall
# elif (ACC_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE)
# define __acc_cdecl_sighandler __clrcall
# elif (ACC_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700))
# if defined(_DLL)
# define __acc_cdecl_sighandler _far _cdecl _loadds
# elif defined(_MT)
# define __acc_cdecl_sighandler _far _cdecl
# else
# define __acc_cdecl_sighandler _cdecl
# endif
# else
# define __acc_cdecl_sighandler __cdecl
# endif
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
# define __acc_cdecl cdecl
#endif
#if !defined(__acc_cdecl)
# define __acc_cdecl
#endif
#if !defined(__acc_cdecl_atexit)
# define __acc_cdecl_atexit
#endif
#if !defined(__acc_cdecl_main)
# define __acc_cdecl_main
#endif
#if !defined(__acc_cdecl_qsort)
# define __acc_cdecl_qsort
#endif
#if !defined(__acc_cdecl_sighandler)
# define __acc_cdecl_sighandler
#endif
#if !defined(__acc_cdecl_va)
# define __acc_cdecl_va __acc_cdecl
#endif
#if (ACC_BROKEN_CDECL_ALT_SYNTAX) #if (ACC_BROKEN_CDECL_ALT_SYNTAX)
typedef void __acc_cdecl_sighandler (*acc_sighandler_t)(int); typedef void __acc_cdecl_sighandler (*acc_sighandler_t)(int);
#elif defined(RETSIGTYPE) #elif defined(RETSIGTYPE)
@ -1676,11 +1689,6 @@ typedef void (__acc_cdecl_sighandler *acc_sighandler_t)(int);
#endif #endif
#endif #endif
#if defined(ACC_WANT_ACC_TYPE_H) #if defined(ACC_WANT_ACC_TYPE_H)
#if (ACC_CC_GNUC >= 0x020800ul)
# define __acc_gnuc_extension__ __extension__
#else
# define __acc_gnuc_extension__
#endif
#if (SIZEOF_LONG_LONG > 0) #if (SIZEOF_LONG_LONG > 0)
__acc_gnuc_extension__ typedef long long acc_llong_t; __acc_gnuc_extension__ typedef long long acc_llong_t;
#endif #endif
@ -1870,66 +1878,6 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
# error "integral constants" # error "integral constants"
# endif # endif
#endif #endif
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC)
# elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
# define __acc_cdecl __cdecl
# define __acc_cdecl_atexit
# define __acc_cdecl_main __cdecl
# if (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
# define __acc_cdecl_qsort __pascal
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
# define __acc_cdecl_qsort _stdcall
# else
# define __acc_cdecl_qsort __cdecl
# endif
# elif (ACC_CC_WATCOMC)
# define __acc_cdecl __cdecl
# else
# define __acc_cdecl __cdecl
# define __acc_cdecl_atexit __cdecl
# define __acc_cdecl_main __cdecl
# define __acc_cdecl_qsort __cdecl
# endif
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC || ACC_CC_WATCOMC)
# elif (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
# define __acc_cdecl_sighandler __pascal
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
# define __acc_cdecl_sighandler _stdcall
# elif (ACC_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE)
# define __acc_cdecl_sighandler __clrcall
# elif (ACC_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700))
# if defined(_DLL)
# define __acc_cdecl_sighandler _far _cdecl _loadds
# elif defined(_MT)
# define __acc_cdecl_sighandler _far _cdecl
# else
# define __acc_cdecl_sighandler _cdecl
# endif
# else
# define __acc_cdecl_sighandler __cdecl
# endif
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
# define __acc_cdecl cdecl
#endif
#if !defined(__acc_cdecl)
# define __acc_cdecl
#endif
#if !defined(__acc_cdecl_atexit)
# define __acc_cdecl_atexit
#endif
#if !defined(__acc_cdecl_main)
# define __acc_cdecl_main
#endif
#if !defined(__acc_cdecl_qsort)
# define __acc_cdecl_qsort
#endif
#if !defined(__acc_cdecl_sighandler)
# define __acc_cdecl_sighandler
#endif
#if !defined(__acc_cdecl_va)
# define __acc_cdecl_va __acc_cdecl
#endif
#if (ACC_BROKEN_CDECL_ALT_SYNTAX) #if (ACC_BROKEN_CDECL_ALT_SYNTAX)
typedef void __acc_cdecl_sighandler (*acc_sighandler_t)(int); typedef void __acc_cdecl_sighandler (*acc_sighandler_t)(int);
#elif defined(RETSIGTYPE) #elif defined(RETSIGTYPE)