From 2076bef95bdd4b1a58c62b365a96c5a5cc122070 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Tue, 20 Sep 2016 20:40:08 +0200 Subject: [PATCH] upx-clang-format -i stdcxx.cpp stdcxx.h ; remove old cruft. --- src/stdcxx.cpp | 32 ++++--------------- src/stdcxx.h | 87 ++------------------------------------------------ 2 files changed, 10 insertions(+), 109 deletions(-) diff --git a/src/stdcxx.cpp b/src/stdcxx.cpp index edeee588..b6039dce 100644 --- a/src/stdcxx.cpp +++ b/src/stdcxx.cpp @@ -25,42 +25,24 @@ */ - -//#define WANT_STL 1 #include "conf.h" #include "stdcxx.h" - #if 1 && defined(__linux__) && (ACC_CC_GNUC >= 0x030400) /* this is used by __gnu_cxx::__verbose_terminate_handler() */ extern "C" { -char * __attribute__((__weak__)) __cxa_demangle(const char *, char *, size_t *, int *); -char *__cxa_demangle(const char *mangled_name, char *buf, size_t *n, int *status) -{ - UNUSED(mangled_name); UNUSED(buf); UNUSED(n); - if (status) *status = -1; /* memory_allocation_failure */ +char *__attribute__((__weak__)) __cxa_demangle(const char *, char *, size_t *, int *); +char *__cxa_demangle(const char *mangled_name, char *buf, size_t *n, int *status) { + UNUSED(mangled_name); + UNUSED(buf); + UNUSED(n); + if (status) + *status = -1; /* memory_allocation_failure */ return NULL; } } /* extern "C" */ #endif - -#ifdef WANT_STL - -#if defined(__GNUC__) -// provide missing oom_handler -void (*__malloc_alloc_template<0>::__malloc_alloc_oom_handler)() = 0; -# if !defined(__USE_MALLOC) -// instantiate default allocator -template class __default_alloc_template; -# endif -#endif - -#endif - - - /* vi:ts=4:et:nowrap */ - diff --git a/src/stdcxx.h b/src/stdcxx.h index c7fc590f..64f335ae 100644 --- a/src/stdcxx.h +++ b/src/stdcxx.h @@ -25,115 +25,34 @@ */ - #ifndef __UPX_STDCXX_H #define __UPX_STDCXX_H 1 #ifdef __cplusplus -#define NOTHROW ACC_CXX_NOTHROW -#define DISABLE_NEW_DELETE ACC_CXX_DISABLE_NEW_DELETE - +#define NOTHROW ACC_CXX_NOTHROW +#define DISABLE_NEW_DELETE ACC_CXX_DISABLE_NEW_DELETE /************************************************************************* // exceptions & RTTI **************************************************************************/ -#if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0530)) - -#include -#undef RWSTD_MULTI_THREAD -#include -#include -#include -namespace std { class bad_alloc { }; } - -#elif (ACC_CC_DMC && (__DMC__ < 0x834)) - -#include -#include - -namespace std { -class exception -{ -public: - exception() NOTHROW { } - virtual ~exception() NOTHROW { } - virtual const char* what() const NOTHROW { return "exception"; } -}; -} - -#elif (ACC_CC_SYMANTECC) - -#include -#include - -class exception -{ -public: - exception() NOTHROW { } - virtual ~exception() NOTHROW { } - virtual const char* what() const NOTHROW { return "exception"; } -}; -#define bool int -#define true 1 -#define false 0 - -#else - #include #include #include -#endif - - -#if (ACC_CC_BORLANDC) -using namespace std; -#elif (ACC_CC_DMC) -namespace std { class bad_alloc { }; } -#elif (ACC_CC_GNUC && ACC_OS_EMX) -#define std /*empty*/ -#elif (ACC_CC_SYMANTECC) -#define std /*empty*/ -class bad_alloc { }; -#endif - - /************************************************************************* // STL **************************************************************************/ #ifdef WANT_STL - -#if defined(__linux__) -# define _NOTHREADS 1 -#endif -#if defined(__GNUC__) -# define __THROW_BAD_ALLOC throw bad_alloc() -# define __USE_MALLOC 1 -# define enable upx_stl_enable -#endif -#if defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable: 4018 4100 4663) -#endif - -#include - -#if defined(_MSC_VER) -# pragma warning(pop) -#endif - +#error "WANT_STL" #endif /* WANT_STL */ - #endif /* __cplusplus */ #endif /* already included */ - /* vi:ts=4:et:nowrap */ -