Remove exceptions

This commit is contained in:
rexy712 2020-10-25 16:41:25 -07:00
parent 6a47a796b9
commit ffc584e56d
2 changed files with 40 additions and 1 deletions

View File

@ -26,7 +26,7 @@ DEPDIR::=$(OBJDIR)/dep
LIBDIRS::=lib
INCLUDE_DIRS::=include
CFLAGS::=-std=c18 -Wall -pedantic -Wextra
CXXFLAGS::=-std=c++17 -Wall -pedantic -Wextra
CXXFLAGS::=-std=c++17 -Wall -pedantic -Wextra -fno-rtti -fno-exceptions
DEBUG_CFLAGS::=
DEBUG_CXXFLAGS::=-DOUR_DICK_DEBUG=2
EXT::=cpp

View File

@ -0,0 +1,39 @@
/**
This file is a part of our_dick
Copyright (C) 2020 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstddef> //size_t
#include <cstdlib> //malloc, free
#include <new>
void* operator new(size_t newsize){
return std::malloc(newsize);
}
void* operator new(size_t newsize, std::align_val_t al){
return ::operator new(newsize, al, std::nothrow);
}
void operator delete(void* ptr)noexcept{
std::free(ptr);
}
void operator delete(void* ptr, std::align_val_t al)noexcept{
::operator delete(ptr, al, std::nothrow);
}
//GCC warns without this one for some reason
void operator delete(void* ptr, size_t)noexcept{
::operator delete(ptr);
}