Browse Source

Support GCC 7 & C++11

tags/1.8.4
parent
commit
2a7b341c71
2 changed files with 28 additions and 6 deletions
  1. +24
    -6
      src/main.cpp
  2. +4
    -0
      src/mathi.h

+ 24
- 6
src/main.cpp View File

@@ -57,11 +57,29 @@ void operator delete[] (void* ptr) { FreeMemSafe(ptr); }

/* GCC 3+ */
#if (__GNUC__ > 2)
/* C++11 */
#if __cplusplus > 199711L
#include <new>
void* operator new (size_t size) throw(std::bad_alloc) { return AllocMemSafe(size); }
void* operator new[] (size_t size) throw(std::bad_alloc) { return AllocMemSafe(size); }
void operator delete (void* ptr) throw() { FreeMemSafe(ptr); }
void operator delete[] (void* ptr) throw() { FreeMemSafe(ptr); }
void* operator new (std::size_t size) { return AllocMemSafe(size); }
void* operator new (std::size_t size, const std::nothrow_t& nothrow_value) noexcept { return AllocMemSafe(size); }
void* operator new[] (std::size_t size) { return AllocMemSafe(size); }
void* operator new[] (std::size_t size, const std::nothrow_t& nothrow_value) noexcept { return AllocMemSafe(size); }
void operator delete (void* ptr) noexcept { FreeMemSafe(ptr); }
void operator delete (void* ptr, const std::nothrow_t& nothrow_constant) noexcept { FreeMemSafe(ptr); }
void operator delete[] (void* ptr) noexcept { FreeMemSafe(ptr); }
void operator delete[] (void* ptr, const std::nothrow_t& nothrow_constant) noexcept { FreeMemSafe(ptr); }
#else
/* C++98 */
#include <new>
void* operator new (std::size_t size) throw (std::bad_alloc) { return AllocMemSafe(size); }
void* operator new (std::size_t size, const std::nothrow_t& nothrow_value) throw() { return AllocMemSafe(size); }
void* operator new[] (std::size_t size) throw (std::bad_alloc) { return AllocMemSafe(size); }
void* operator new[] (std::size_t size, const std::nothrow_t& nothrow_value) throw() { return AllocMemSafe(size); }
void operator delete (void* ptr) throw() { FreeMemSafe(ptr); }
void operator delete (void* ptr, const std::nothrow_t& nothrow_constant) throw() { FreeMemSafe(ptr); }
void operator delete[] (void* ptr) throw() { FreeMemSafe(ptr); }
void operator delete[] (void* ptr, const std::nothrow_t& nothrow_constant) throw() { FreeMemSafe(ptr); }
#endif
#endif

/* MSVC++ */
@@ -82,11 +100,11 @@ void WriteOutInt(int value) { printf("%i", value); }
int main(int argc, char** argv)
{
#if defined(WITHTEST)
if (argc == 2 && StrIsEqual(argv[1], "test"))
if (argc == 2 && StrIsEqual(argv[1], "--test"))
{
Program = new TestProgram(false);
}
else if (argc == 2 && StrIsEqual(argv[1], "testz"))
else if (argc == 2 && StrIsEqual(argv[1], "--testz"))
{
Program = new TestProgram(true);
}


+ 4
- 0
src/mathi.h View File

@@ -30,6 +30,10 @@
#ifndef AMATH_LIB_COMPLEX_H
#define AMATH_LIB_COMPLEX_H

#if __GNUC__ > 2
#pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch"
#endif

/**
* @file mathi.h
* @brief Complex numbers math library


Loading…
Cancel
Save