Skip to content

[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

Merged
merged 2 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion libc/src/__support/CPP/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <stddef.h> // For size_t

#include "array.h" // For array
#include "array.h" // For array
#include "src/__support/macros/config.h"
#include "type_traits.h" // For remove_cv_t, enable_if_t, is_same_v, is_const_v

Expand Down Expand Up @@ -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) {}

Expand Down
2 changes: 2 additions & 0 deletions libc/test/src/setjmp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/setjmp/setjmp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down