upx-clang-format -i stdcxx.cpp stdcxx.h ; remove old cruft.

This commit is contained in:
Markus F.X.J. Oberhumer
2016-09-20 20:40:08 +02:00
parent 48ce1f1814
commit 2076bef95b
2 changed files with 10 additions and 109 deletions
+7 -25
View File
@@ -25,42 +25,24 @@
<markus@oberhumer.com> <ml1050@users.sourceforge.net> <markus@oberhumer.com> <ml1050@users.sourceforge.net>
*/ */
//#define WANT_STL 1
#include "conf.h" #include "conf.h"
#include "stdcxx.h" #include "stdcxx.h"
#if 1 && defined(__linux__) && (ACC_CC_GNUC >= 0x030400) #if 1 && defined(__linux__) && (ACC_CC_GNUC >= 0x030400)
/* this is used by __gnu_cxx::__verbose_terminate_handler() */ /* this is used by __gnu_cxx::__verbose_terminate_handler() */
extern "C" { extern "C" {
char * __attribute__((__weak__)) __cxa_demangle(const char *, char *, size_t *, int *); 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) char *__cxa_demangle(const char *mangled_name, char *buf, size_t *n, int *status) {
{ UNUSED(mangled_name);
UNUSED(mangled_name); UNUSED(buf); UNUSED(n); UNUSED(buf);
if (status) *status = -1; /* memory_allocation_failure */ UNUSED(n);
if (status)
*status = -1; /* memory_allocation_failure */
return NULL; return NULL;
} }
} /* extern "C" */ } /* extern "C" */
#endif #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<false, 0>;
# endif
#endif
#endif
/* /*
vi:ts=4:et:nowrap vi:ts=4:et:nowrap
*/ */
+3 -84
View File
@@ -25,115 +25,34 @@
<markus@oberhumer.com> <ml1050@users.sourceforge.net> <markus@oberhumer.com> <ml1050@users.sourceforge.net>
*/ */
#ifndef __UPX_STDCXX_H #ifndef __UPX_STDCXX_H
#define __UPX_STDCXX_H 1 #define __UPX_STDCXX_H 1
#ifdef __cplusplus #ifdef __cplusplus
#define NOTHROW ACC_CXX_NOTHROW #define NOTHROW ACC_CXX_NOTHROW
#define DISABLE_NEW_DELETE ACC_CXX_DISABLE_NEW_DELETE #define DISABLE_NEW_DELETE ACC_CXX_DISABLE_NEW_DELETE
/************************************************************************* /*************************************************************************
// exceptions & RTTI // exceptions & RTTI
**************************************************************************/ **************************************************************************/
#if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0530))
#include <stdcomp.h>
#undef RWSTD_MULTI_THREAD
#include <stdexcep.h>
#include <new.h>
#include <typeinfo.h>
namespace std { class bad_alloc { }; }
#elif (ACC_CC_DMC && (__DMC__ < 0x834))
#include <new.h>
#include <typeinfo.h>
namespace std {
class exception
{
public:
exception() NOTHROW { }
virtual ~exception() NOTHROW { }
virtual const char* what() const NOTHROW { return "exception"; }
};
}
#elif (ACC_CC_SYMANTECC)
#include <new.h>
#include <typeinfo.h>
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 <exception> #include <exception>
#include <new> #include <new>
#include <typeinfo> #include <typeinfo>
#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 // STL
**************************************************************************/ **************************************************************************/
#ifdef WANT_STL #ifdef WANT_STL
#error "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 <vector>
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif /* WANT_STL */ #endif /* WANT_STL */
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* already included */ #endif /* already included */
/* /*
vi:ts=4:et:nowrap vi:ts=4:et:nowrap
*/ */