Do not include bits/functexcept.h when building with libc++

This header exists only in GCC's libstdc++. If we are building on a
system using exclusively LLVM's libc++, compilation will fail.
This commit is contained in:
0xC0ncord 2022-05-07 11:54:31 -04:00
parent 0d6d63cbe7
commit aa63cf1d19
No known key found for this signature in database
GPG key ID: 16DEEFE55F45B79E
4 changed files with 10 additions and 1 deletions

View file

@ -44,7 +44,11 @@ OBJECTS := $(SOURCES:.c=.o)
ifeq ($(CONFIG_CXX_ALLOCATOR),true)
# make sure LTO is compatible in case CC and CXX don't match (such as clang and g++)
CXX := $(CC)
LDLIBS += -lstdc++
ifeq ($(CONFIG_USE_LIBCXX),true)
LDLIBS += -lc++
else
LDLIBS += -lstdc++
endif
SOURCES += new.cc
OBJECTS += new.o
@ -85,6 +89,7 @@ ifeq (,$(filter $(CONFIG_STATS),true false))
endif
CPPFLAGS += \
-DCONFIG_USE_LIBCXX=$(CONFIG_USE_LIBCXX) \
-DCONFIG_SEAL_METADATA=$(CONFIG_SEAL_METADATA) \
-DZERO_ON_FREE=$(CONFIG_ZERO_ON_FREE) \
-DWRITE_AFTER_FREE_CHECK=$(CONFIG_WRITE_AFTER_FREE_CHECK) \

View file

@ -1,6 +1,7 @@
CONFIG_WERROR := true
CONFIG_NATIVE := true
CONFIG_CXX_ALLOCATOR := true
CONFIG_USE_LIBCXX := false
CONFIG_UBSAN := false
CONFIG_SEAL_METADATA := false
CONFIG_ZERO_ON_FREE := true

View file

@ -1,6 +1,7 @@
CONFIG_WERROR := true
CONFIG_NATIVE := true
CONFIG_CXX_ALLOCATOR := true
CONFIG_USE_LIBCXX := false
CONFIG_UBSAN := false
CONFIG_SEAL_METADATA := false
CONFIG_ZERO_ON_FREE := true

2
new.cc
View file

@ -1,4 +1,6 @@
#if !defined(__clang__) || !CONFIG_USE_LIBCXX
#include <bits/functexcept.h>
#endif
#include <new>
#include "h_malloc.h"