Skip to content
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
2 changes: 1 addition & 1 deletion libcxx/include/fstream
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ _LIBCPP_PUSH_MACROS

_LIBCPP_BEGIN_NAMESPACE_STD

# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_WIN32API)
# if _LIBCPP_STD_VER >= 23 && defined(_LIBCPP_WIN32API)
_LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) noexcept;
# endif

Expand Down
4 changes: 4 additions & 0 deletions libcxx/src/atomic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ __atomic_notify_all_native<sizeof(__cxx_contention_t)>(void const* __location) n
// =============================================================
// Old dylib exported symbols, for backwards compatibility
// =============================================================
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes")

_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile* __location) noexcept {
__atomic_notify_global_table(const_cast<void const*>(__location));
Expand Down Expand Up @@ -410,4 +412,6 @@ __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) no
return __cxx_atomic_load(__location, memory_order_acquire);
}

_LIBCPP_DIAGNOSTIC_POP

_LIBCPP_END_NAMESPACE_STD
5 changes: 4 additions & 1 deletion libcxx/src/charconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD

namespace __itoa {

_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes")
// These functions exist for ABI compatibility, so we don't ever want a declaration prior to the definition.
_LIBCPP_EXPORTED_FROM_ABI char* __u32toa(uint32_t value, char* buffer) noexcept { return __base_10_u32(buffer, value); }

_LIBCPP_EXPORTED_FROM_ABI char* __u64toa(uint64_t value, char* buffer) noexcept { return __base_10_u64(buffer, value); }
_LIBCPP_DIAGNOSTIC_POP

} // namespace __itoa

Expand Down
2 changes: 1 addition & 1 deletion libcxx/src/experimental/time_zone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ __get_sys_info(sys_seconds __time,
// Iff the "offsets" are the same '__current.__end' is replaced with
// '__next.__end', which effectively merges the two objects in one object. The
// function returns true if a merge occurred.
[[nodiscard]] bool __merge_continuation(sys_info& __current, const sys_info& __next) {
[[nodiscard]] static bool __merge_continuation(sys_info& __current, const sys_info& __next) {
if (__current.end != __next.begin)
return false;

Expand Down
3 changes: 3 additions & 0 deletions libcxx/src/experimental/tzdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD

namespace chrono {

_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes")
// This function is weak so it can be overriden in the tests. The
// declaration is in the test header test/support/test_tzdb.h
_LIBCPP_WEAK string_view __libcpp_tzdb_directory() {
Expand All @@ -58,6 +60,7 @@ _LIBCPP_WEAK string_view __libcpp_tzdb_directory() {
# error "unknown path to the IANA Time Zone Database"
#endif
}
_LIBCPP_DIAGNOSTIC_POP

//===----------------------------------------------------------------------===//
// Details
Expand Down
2 changes: 2 additions & 0 deletions libcxx/src/filesystem/int128_builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <__config>
#include <climits>

_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes") // See the FIXME above

#if _LIBCPP_HAS_INT128

extern "C" __attribute__((no_sanitize("undefined"))) _LIBCPP_EXPORTED_FROM_ABI __int128_t
Expand Down
4 changes: 2 additions & 2 deletions libcxx/src/include/from_chars_floating_point.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ struct __exponent_result {
// __offset, 0, false. This allows using the results unconditionally, the
// __present is important for the scientific notation, where the value is
// mandatory.
__exponent_result __parse_exponent(const char* __input, size_t __n, size_t __offset, char __marker) {
static __exponent_result __parse_exponent(const char* __input, size_t __n, size_t __offset, char __marker) {
if (__offset + 1 < __n && // an exponent always needs at least one digit.
std::tolower(__input[__offset]) == __marker && //
!std::isspace(__input[__offset + 1]) // leading whitespace is not allowed.
Expand All @@ -217,7 +217,7 @@ __exponent_result __parse_exponent(const char* __input, size_t __n, size_t __off
}

// Here we do this operation as int64 to avoid overflow.
int32_t __merge_exponents(int64_t __fractional, int64_t __exponent, int __max_biased_exponent) {
static int32_t __merge_exponents(int64_t __fractional, int64_t __exponent, int __max_biased_exponent) {
int64_t __sum = __fractional + __exponent;

if (__sum > __max_biased_exponent)
Expand Down
2 changes: 2 additions & 0 deletions libcxx/src/support/win32/compiler_rt_shims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <cmath>
#include <complex>

_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes") // See comment above

template <class T>
static std::__complex_t<T> mul_impl(T a, T b, T c, T d) {
T __ac = a * c;
Expand Down
2 changes: 1 addition & 1 deletion libcxx/src/support/win32/locale_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int __snprintf(char* ret, size_t n, __locale_t loc, const char* format, ...) {
// Like sprintf, but when return value >= 0 it returns
// a pointer to a malloc'd string in *sptr.
// If return >= 0, use free to delete *sptr.
int __libcpp_vasprintf(char** sptr, const char* __restrict format, va_list ap) {
static int __libcpp_vasprintf(char** sptr, const char* __restrict format, va_list ap) {
*sptr = nullptr;
// Query the count required.
va_list ap_copy;
Expand Down
8 changes: 5 additions & 3 deletions libcxxabi/src/cxa_personality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
# define __ptrauth_scan_results_landingpad_intptr
#endif

// The functions defined in this file are magic functions called only by the compiler.
#ifdef __clang__
# pragma clang diagnostic ignored "-Wmissing-prototypes"
#endif

// TODO: This is a temporary workaround for libc++abi to recognize that it's being
// built against LLVM's libunwind. LLVM's libunwind started reporting _LIBUNWIND_VERSION
// in LLVM 15 -- we can remove this workaround after shipping LLVM 17. Once we remove
Expand Down Expand Up @@ -1120,9 +1125,6 @@ __gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame,

#else

extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*,
_Unwind_Context*);

// Helper function to unwind one frame.
// ARM EHABI 7.3 and 7.4: If the personality function returns _URC_CONTINUE_UNWIND, the
// personality routine should update the virtual register set (VRS) according to the
Expand Down
3 changes: 2 additions & 1 deletion libcxxabi/src/cxa_thread_atexit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ namespace {

#endif // HAVE___CXA_THREAD_ATEXIT_IMPL

#if defined(__linux__) || defined(__Fuchsia__)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for __cxa_thread_atexit to have become Linux and Fuchsia-only? Did it conflict with libc's one on OSes having it there?

I'm unable to build a 22.1.2 ecosystem from a 22.1.2 on FreeBSD 10 (… OK it's 10 years old), due to undefined reference to '__cxa_thread_atexit',
while I could from a 21.1.6: libc++abi 21.1.6 defining __cxa_thread_atexit (and expecting an external __cxa_thread_atexit_impl) supplements libc not having it; and, on a FreeBSD 15.0 (where libc has its __cxa_thread_atexit), that same __cxa_thread_atexit doesn't seem to hinder.

So based on my small experience I'd say that letting it defined doesn't hurt (thanks to some overloading magics, perhaps specific to my Frankenstein-like FreeBSD/libc++abi environments?)

@outtersg outtersg Apr 1, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking a bit harder I just noticed the question has already been asked in #186054, and specifically #186054 (comment) that mentions that, contrary to what I noticed on my FreeBSD 10, defining __cxa_thread_atexit made the FreeBSD 13 CI fail.

extern "C" {

_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void* obj, void* dso_symbol) throw() {
Expand Down Expand Up @@ -140,6 +141,6 @@ extern "C" {
}
#endif // HAVE___CXA_THREAD_ATEXIT_IMPL
}

} // extern "C"
#endif // defined(__linux__) || defined(__Fuchsia__)
} // namespace __cxxabiv1
6 changes: 6 additions & 0 deletions libcxxabi/src/private_typeinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@ bool __pointer_to_member_type_info::can_catch_nested(
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif

#pragma GCC diagnostic push
// __dynamic_cast is called by the compiler, so there is no prototype
#pragma GCC diagnostic ignored "-Wmissing-prototypes"

// __dynamic_cast

// static_ptr: pointer to an object of type static_type; nonnull, and since the
Expand Down Expand Up @@ -953,6 +957,8 @@ __dynamic_cast(const void *static_ptr, const __class_type_info *static_type,
return const_cast<void*>(dst_ptr);
}

#pragma GCC diagnostic pop

#ifdef __clang__
#pragma clang diagnostic pop
#endif
Expand Down
5 changes: 4 additions & 1 deletion libunwind/include/unwind_arm_ehabi.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ _Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
uint32_t discriminator,
_Unwind_VRS_DataRepresentation representation);

extern _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception *,
_Unwind_Context *);

#if defined(_LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE)
#define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 extern
#define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 extern __inline__

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanielKristofKiss I don't have any context about this code. Our understanding is that without __inline__, we're defining strong symbols in a header which is an ODR violation. Can you weigh in?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked, and technically this isn't an ODR violation. However, AFAICT these are intended to provide the definitions to people who are naughty and declare their own versions of these functions, so I believe this change is correct.

#else
#define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 static __inline__
#endif
Expand Down
1 change: 0 additions & 1 deletion libunwind/src/UnwindLevel1.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
}
return _URC_NO_REASON;
}
extern int __unw_step_stage2(unw_cursor_t *);

#if defined(_LIBUNWIND_USE_GCS)
// Enable the GCS target feature to permit gcspop instructions to be used.
Expand Down
1 change: 1 addition & 0 deletions libunwind/src/Unwind_AIXExtras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// This file is only used for AIX.
#if defined(_AIX)

#include "AddressSpace.hpp"
#include "config.h"
#include "libunwind_ext.h"
#include <sys/debug.h>
Expand Down
1 change: 1 addition & 0 deletions libunwind/src/libunwind_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern "C" {
extern int __unw_getcontext(unw_context_t *);
extern int __unw_init_local(unw_cursor_t *, unw_context_t *);
extern int __unw_step(unw_cursor_t *);
extern int __unw_step_stage2(unw_cursor_t *);
extern int __unw_get_reg(unw_cursor_t *, unw_regnum_t, unw_word_t *);
extern int __unw_get_fpreg(unw_cursor_t *, unw_regnum_t, unw_fpreg_t *);
extern int __unw_set_reg(unw_cursor_t *, unw_regnum_t, unw_word_t);
Expand Down
1 change: 1 addition & 0 deletions runtimes/cmake/Modules/WarningFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function(cxx_add_warning_flags target enable_werror enable_pedantic)
-Wzero-length-array
-Wdeprecated-redundant-constexpr-static-def
-Wno-nullability-completeness
-Wmissing-prototypes
)

if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
Expand Down
Loading