mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 10:05:29 +00:00
Exception specifications are a deprecated feature in C++11 and gcc 7
complains about these specifications. Hence remove these specifications.
This patch avoids that gcc reports the following:
warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16360
61 lines
1.1 KiB
C++
61 lines
1.1 KiB
C++
// operator new(unsigned)
|
|
// operator new[](unsigned)
|
|
// operator new(unsigned, std::nothrow_t const&)
|
|
// operator new[](unsigned, std::nothrow_t const&)
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <new>
|
|
|
|
using std::nothrow_t;
|
|
|
|
// A big structure. Its details don't matter.
|
|
typedef struct {
|
|
int array[1000];
|
|
} s;
|
|
|
|
__attribute__((noinline)) void* operator new (std::size_t n)
|
|
{
|
|
return malloc(n);
|
|
}
|
|
|
|
__attribute__((noinline)) void* operator new (std::size_t n, std::nothrow_t const &)
|
|
{
|
|
return malloc(n);
|
|
}
|
|
|
|
__attribute__((noinline)) void* operator new[] (std::size_t n)
|
|
{
|
|
return malloc(n);
|
|
}
|
|
|
|
__attribute__((noinline)) void* operator new[] (std::size_t n, std::nothrow_t const &)
|
|
{
|
|
return malloc(n);
|
|
}
|
|
|
|
__attribute__((noinline)) void operator delete (void* p)
|
|
{
|
|
return free(p);
|
|
}
|
|
|
|
__attribute__((noinline)) void operator delete[] (void* p)
|
|
{
|
|
return free(p);
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
s* p1 = new s;
|
|
s* p2 = new (std::nothrow) s;
|
|
char* c1 = new char[2000];
|
|
char* c2 = new (std::nothrow) char[2000];
|
|
delete p1;
|
|
delete p2;
|
|
delete [] c1;
|
|
delete [] c2;
|
|
return 0;
|
|
}
|
|
|
|
|