summaryrefslogtreecommitdiff
path: root/libcxxabi
diff options
context:
space:
mode:
authorNikolas Klauser <nikolasklauser@berlin.de>2023-02-17 11:31:41 +0100
committerNikolas Klauser <nikolasklauser@berlin.de>2023-03-17 00:40:59 +0100
commita7aade1f36eb60161235b66bca46db12e5326a0c (patch)
tree06731b1487f7b1caceedb37cbf01f53594c3679b /libcxxabi
parent88eb4cbbfe7ded9556131c3bd4228ee9e9d01b4d (diff)
downloadllvm-a7aade1f36eb60161235b66bca46db12e5326a0c.tar.gz
[runtimes] Synchronize warnings flags between libc++/libc++abi/libunwind
This mostly keeps the same warning flags. The most important exceptions are `-Wpedantic` and `-Wconversion`, which are now removed from libc++abi and libunwind. Reviewed By: ldionne, #libunwind, #libc, #libc_abi Spies: mikhail.ramalho, phosek, libcxx-commits Differential Revision: https://reviews.llvm.org/D144252
Diffstat (limited to 'libcxxabi')
-rw-r--r--libcxxabi/CMakeLists.txt37
-rw-r--r--libcxxabi/src/CMakeLists.txt4
-rw-r--r--libcxxabi/src/demangle/ItaniumDemangle.h10
3 files changed, 15 insertions, 36 deletions
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 4dd9f092dbf0..9239274d7af1 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -44,7 +44,7 @@ option(LIBCXXABI_ENABLE_EXCEPTIONS
"Provide support for exceptions in the runtime.
When disabled, libc++abi does not support stack unwinding and other exceptions-related features." ON)
option(LIBCXXABI_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
-option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
+option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF)
option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." OFF)
@@ -279,41 +279,6 @@ add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
# it is being built as part of libcxx.
add_definitions(-D_LIBCPP_BUILDING_LIBRARY)
-add_compile_flags_if_supported(-Werror=return-type)
-
-# Get warning flags
-add_compile_flags_if_supported(-W)
-add_compile_flags_if_supported(-Wall)
-add_compile_flags_if_supported(-Wchar-subscripts)
-add_compile_flags_if_supported(-Wconversion)
-add_compile_flags_if_supported(-Wmismatched-tags)
-add_compile_flags_if_supported(-Wmissing-braces)
-add_compile_flags_if_supported(-Wnewline-eof)
-add_compile_flags_if_supported(-Wunused-function)
-add_compile_flags_if_supported(-Wshadow)
-add_compile_flags_if_supported(-Wshorten-64-to-32)
-add_compile_flags_if_supported(-Wsign-compare)
-add_compile_flags_if_supported(-Wsign-conversion)
-add_compile_flags_if_supported(-Wstrict-aliasing=2)
-add_compile_flags_if_supported(-Wstrict-overflow=4)
-add_compile_flags_if_supported(-Wunused-parameter)
-add_compile_flags_if_supported(-Wunused-variable)
-add_compile_flags_if_supported(-Wwrite-strings)
-add_compile_flags_if_supported(-Wundef)
-
-add_compile_flags_if_supported(-Wno-suggest-override)
-
-if (LIBCXXABI_ENABLE_WERROR)
- add_compile_flags_if_supported(-Werror)
- add_compile_flags_if_supported(-WX)
-else()
- add_compile_flags_if_supported(-Wno-error)
- add_compile_flags_if_supported(-WX-)
-endif()
-if (LIBCXXABI_ENABLE_PEDANTIC)
- add_compile_flags_if_supported(-pedantic)
-endif()
-
# Get feature flags.
add_compile_flags_if_supported(-fstrict-aliasing)
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 58df59a5725a..4c27a25fc475 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -158,8 +158,11 @@ if (NOT TARGET pstl::ParallelSTL)
message(STATUS "Could not find ParallelSTL, libc++abi will not attempt to use it but the build may fail if the libc++ in use needs it to be available.")
endif()
+include(WarningFlags)
+
# Build the shared library.
add_library(cxxabi_shared_objects OBJECT EXCLUDE_FROM_ALL ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
+cxx_add_warning_flags(cxxabi_shared_objects ${LIBCXXABI_ENABLE_WERROR} ${LIBCXXABI_ENABLE_PEDANTIC})
if (LIBCXXABI_USE_LLVM_UNWINDER)
if (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY)
target_link_libraries(cxxabi_shared_objects PUBLIC unwind_shared_objects) # propagate usage requirements
@@ -246,6 +249,7 @@ endif()
# Build the static library.
add_library(cxxabi_static_objects OBJECT EXCLUDE_FROM_ALL ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
+cxx_add_warning_flags(cxxabi_static_objects ${LIBCXXABI_ENABLE_WERROR} ${LIBCXXABI_ENABLE_PEDANTIC})
if (LIBCXXABI_USE_LLVM_UNWINDER AND LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY)
target_link_libraries(cxxabi_static_objects PUBLIC unwind_static_objects) # propagate usage requirements
target_sources(cxxabi_static_objects PUBLIC $<TARGET_OBJECTS:unwind_static_objects>)
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h
index f71f61f316b4..22a35a815299 100644
--- a/libcxxabi/src/demangle/ItaniumDemangle.h
+++ b/libcxxabi/src/demangle/ItaniumDemangle.h
@@ -19,6 +19,7 @@
#include "DemangleConfig.h"
#include "StringView.h"
#include "Utility.h"
+#include <__cxxabi_config.h>
#include <algorithm>
#include <cassert>
#include <cctype>
@@ -30,6 +31,11 @@
#include <type_traits>
#include <utility>
+#ifdef _LIBCXXABI_COMPILER_CLANG
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-template"
+#endif
+
DEMANGLE_NAMESPACE_BEGIN
template <class T, size_t N> class PODSmallVector {
@@ -5498,4 +5504,8 @@ struct ManglingParser : AbstractManglingParser<ManglingParser<Alloc>, Alloc> {
DEMANGLE_NAMESPACE_END
+#ifdef _LIBCXXABI_COMPILER_CLANG
+#pragma clang diagnostic pop
+#endif
+
#endif // DEMANGLE_ITANIUMDEMANGLE_H