-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] Build with -Wdeprecated, fix some warnings #125373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
While GCC's -Wdeprecated is on by default and doesn't do much, Clang's -Wdeprecated enables many more things. More apply in C++20, so switch a test file that tickled one to using that. In future, C++20 should probably be made the baseline for compiling all the libc code.
@llvm/pr-subscribers-libc Author: Roland McGrath (frobtech) ChangesWhile GCC's -Wdeprecated is on by default and doesn't do much, Full diff: https://github.com/llvm/llvm-project/pull/125373.diff 4 Files Affected:
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index 12420db331961bf..0facb0b9be0c134 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -179,8 +179,9 @@ function(_get_common_compile_options output_var flags)
endif()
list(APPEND compile_options "-Wconversion")
list(APPEND compile_options "-Wno-sign-conversion")
- # Silence this warning because _Complex is a part of C99.
+ list(APPEND compile_options "-Wdeprecated")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ # Silence this warning because _Complex is a part of C99.
list(APPEND compile_options "-fext-numeric-literals")
else()
list(APPEND compile_options "-Wno-c99-extensions")
diff --git a/libc/src/__support/CPP/span.h b/libc/src/__support/CPP/span.h
index e9e3dbf169ce027..e5073bd3c9d871a 100644
--- a/libc/src/__support/CPP/span.h
+++ b/libc/src/__support/CPP/span.h
@@ -52,6 +52,8 @@ template <typename T> class span {
LIBC_INLINE constexpr span() : span_data(nullptr), span_size(0) {}
+ LIBC_INLINE constexpr span(const span&) = default;
+
LIBC_INLINE constexpr span(pointer first, size_type count)
: span_data(first), span_size(count) {}
diff --git a/libc/test/src/setjmp/CMakeLists.txt b/libc/test/src/setjmp/CMakeLists.txt
index 049df89ba39a6f7..392230784bd993d 100644
--- a/libc/test/src/setjmp/CMakeLists.txt
+++ b/libc/test/src/setjmp/CMakeLists.txt
@@ -11,6 +11,8 @@ add_libc_unittest(
libc_setjmp_unittests
SRCS
setjmp_test.cpp
+ CXX_STANDARD
+ 20
DEPENDS
libc.src.setjmp.longjmp
libc.src.setjmp.setjmp
diff --git a/libc/test/src/setjmp/setjmp_test.cpp b/libc/test/src/setjmp/setjmp_test.cpp
index 9e5f74a1734b353..27113cd6e06311b 100644
--- a/libc/test/src/setjmp/setjmp_test.cpp
+++ b/libc/test/src/setjmp/setjmp_test.cpp
@@ -27,7 +27,7 @@ TEST(LlvmLibcSetJmpTest, SetAndJumpBack) {
// The first time setjmp is called, it should return 0.
// Subsequent calls will return the value passed to jump_back below.
if (LIBC_NAMESPACE::setjmp(buf) <= MAX_LOOP) {
- ++n;
+ n = n + 1;
jump_back(buf, n);
}
ASSERT_EQ(longjmp_called, n);
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/12875 Here is the relevant piece of the build log for the reference
|
+1; actively working towards that. Unfortunately the list of dependencies for that is getting quite long (need to upgrade minimum supported toolchains, need to upgrade buildbots). Right now, I'm focused on cross compiling such that I have only 1 buildbot I need to sysadmin/devops for. That should let me spin down all of our other build bots, such that upgrading dependencies for CI only needs to be done in one place. In particular, our RISCV64 buildbot seems to be running a fork of debian that hasn't been updated (because there is no updated image or any updated packages) since the initial system image was created... |
While GCC's -Wdeprecated is on by default and doesn't do much,
Clang's -Wdeprecated enables many more things. More apply in
C++20, so switch a test file that tickled one to using that. In
future, C++20 should probably be made the baseline for compiling
all the libc code.