mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix non-throwing operator new failure checks being optimized away.
This commit is contained in:
parent
4b376c7f16
commit
322c8317d6
6 changed files with 10 additions and 6 deletions
|
@ -7,7 +7,7 @@ OPTLEVEL?=$(DEFAULT_OPTLEVEL)
|
|||
CXXFLAGS?=$(OPTLEVEL)
|
||||
|
||||
CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\"
|
||||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
|
||||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti -fcheck-new
|
||||
|
||||
LIBS:=$(LIBS)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ CFLAGS?=$(OPTLEVEL)
|
|||
CXXFLAGS?=$(OPTLEVEL)
|
||||
|
||||
CFLAGS:=$(CFLAGS) -Wall -Wextra
|
||||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
|
||||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti -fcheck-new
|
||||
|
||||
BINARIES:=\
|
||||
asteroids \
|
||||
|
|
|
@ -13,7 +13,7 @@ CXXFLAGS?=$(OPTLEVEL)
|
|||
|
||||
CPPFLAGS:=$(CPPFLAGS) -I. -Iinclude -D__is_sortix_kernel
|
||||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -ffreestanding -fbuiltin -std=gnu++11 \
|
||||
-fno-exceptions -fno-rtti
|
||||
-fno-exceptions -fno-rtti -fcheck-new
|
||||
|
||||
ifeq ($(PANIC_SHORT),1)
|
||||
CPPFLAGS:=$(CPPFLAGS) -DPANIC_SHORT
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 2012, 2013 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2011, 2012, 2013, 2022 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -20,6 +20,10 @@
|
|||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#warning "security: -fcheck-new might not work on clang"
|
||||
#endif
|
||||
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
|
|
|
@ -12,7 +12,7 @@ CPPINCLUDES=-Iinclude
|
|||
CPPFLAGS=-D__is_sortix_libc $(CPPINCLUDES)
|
||||
FLAGS=-Wall -Wextra -ffreestanding $(OPTLEVEL)
|
||||
CFLAGS=-std=gnu11 -Wstrict-prototypes -Werror=implicit-function-declaration
|
||||
CXXFLAGS=-std=gnu++11 -fno-exceptions -fno-rtti
|
||||
CXXFLAGS=-std=gnu++11 -fno-exceptions -fno-rtti -fcheck-new
|
||||
ASFLAGS=
|
||||
|
||||
FREEOBJS=\
|
||||
|
|
|
@ -7,7 +7,7 @@ include ../build-aux/dirs.mak
|
|||
OPTLEVEL?=-g -O2
|
||||
CXXFLAGS?=$(OPTLEVEL)
|
||||
|
||||
CXXFLAGS:=$(CXXFLAGS) -std=gnu++11 -Wall -Wextra -fno-exceptions -fno-rtti
|
||||
CXXFLAGS:=$(CXXFLAGS) -std=gnu++11 -Wall -Wextra -fno-exceptions -fno-rtti -fcheck-new
|
||||
|
||||
BINARY:=trianglix
|
||||
|
||||
|
|
Loading…
Reference in a new issue