Skip to content

Commit 3f3478d

Browse files
committed
[libc++] Enable -Wmissing-prototypes
1 parent 427ce92 commit 3f3478d

File tree

17 files changed

+35
-8
lines changed

17 files changed

+35
-8
lines changed

libcxx/include/fstream

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ _LIBCPP_PUSH_MACROS
220220

221221
_LIBCPP_BEGIN_NAMESPACE_STD
222222

223-
# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_WIN32API)
223+
# if _LIBCPP_STD_VER >= 23 && defined(_LIBCPP_WIN32API)
224224
_LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) noexcept;
225225
# endif
226226

libcxx/src/charconv.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
1818

1919
namespace __itoa {
2020

21+
_LIBCPP_DIAGNOSTIC_PUSH
22+
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes")
23+
// These functions exist for ABI compatibility, so we don't ever want a declaration.
2124
_LIBCPP_EXPORTED_FROM_ABI char* __u32toa(uint32_t value, char* buffer) noexcept { return __base_10_u32(buffer, value); }
22-
2325
_LIBCPP_EXPORTED_FROM_ABI char* __u64toa(uint64_t value, char* buffer) noexcept { return __base_10_u64(buffer, value); }
26+
_LIBCPP_DIAGNOSTIC_POP
2427

2528
} // namespace __itoa
2629

libcxx/src/experimental/time_zone.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ __get_sys_info(sys_seconds __time,
711711
// Iff the "offsets" are the same '__current.__end' is replaced with
712712
// '__next.__end', which effectively merges the two objects in one object. The
713713
// function returns true if a merge occurred.
714-
[[nodiscard]] bool __merge_continuation(sys_info& __current, const sys_info& __next) {
714+
[[nodiscard]] static bool __merge_continuation(sys_info& __current, const sys_info& __next) {
715715
if (__current.end != __next.begin)
716716
return false;
717717

libcxx/src/experimental/tzdb.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4949

5050
namespace chrono {
5151

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

6265
//===----------------------------------------------------------------------===//
6366
// Details

libcxx/src/filesystem/int128_builtins.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <__config>
1717
#include <climits>
1818

19+
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes") // See the FIXME above
20+
1921
#if _LIBCPP_HAS_INT128
2022

2123
extern "C" __attribute__((no_sanitize("undefined"))) _LIBCPP_EXPORTED_FROM_ABI __int128_t

libcxx/src/include/from_chars_floating_point.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ struct __exponent_result {
193193
// __offset, 0, false. This allows using the results unconditionally, the
194194
// __present is important for the scientific notation, where the value is
195195
// mandatory.
196-
__exponent_result __parse_exponent(const char* __input, size_t __n, size_t __offset, char __marker) {
196+
static __exponent_result __parse_exponent(const char* __input, size_t __n, size_t __offset, char __marker) {
197197
if (__offset + 1 < __n && // an exponent always needs at least one digit.
198198
std::tolower(__input[__offset]) == __marker && //
199199
!std::isspace(__input[__offset + 1]) // leading whitespace is not allowed.
@@ -213,7 +213,7 @@ __exponent_result __parse_exponent(const char* __input, size_t __n, size_t __off
213213
}
214214

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

219219
if (__sum > __max_biased_exponent)

libcxx/src/support/win32/compiler_rt_shims.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <cmath>
1515
#include <complex>
1616

17+
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes") // See comment above
18+
1719
template <class T>
1820
static std::__complex_t<T> mul_impl(T a, T b, T c, T d) {
1921
T __ac = a * c;

libcxx/src/support/win32/locale_win32.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ int __snprintf(char* ret, size_t n, __locale_t loc, const char* format, ...) {
144144
// Like sprintf, but when return value >= 0 it returns
145145
// a pointer to a malloc'd string in *sptr.
146146
// If return >= 0, use free to delete *sptr.
147-
int __libcpp_vasprintf(char** sptr, const char* __restrict format, va_list ap) {
147+
static int __libcpp_vasprintf(char** sptr, const char* __restrict format, va_list ap) {
148148
*sptr = nullptr;
149149
// Query the count required.
150150
va_list ap_copy;

libcxxabi/src/cxa_personality.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
#include "private_typeinfo.h"
2323
#include "unwind.h"
2424

25+
// The functions defined in this file are magic functions called only by the compiler.
26+
#ifdef __clang__
27+
# pragma clang diagnostic ignored "-Wmissing-prototypes"
28+
#endif
29+
2530
// TODO: This is a temporary workaround for libc++abi to recognize that it's being
2631
// built against LLVM's libunwind. LLVM's libunwind started reporting _LIBUNWIND_VERSION
2732
// in LLVM 15 -- we can remove this workaround after shipping LLVM 17. Once we remove

libcxxabi/src/private_typeinfo.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,10 @@ bool __pointer_to_member_type_info::can_catch_nested(
831831
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
832832
#endif
833833

834+
#pragma GCC diagnostic push
835+
// __dynamic_cast is called by the compiler, so there is no prototype
836+
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
837+
834838
// __dynamic_cast
835839

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

960+
#pragma GCC diagnostic pop
961+
956962
#ifdef __clang__
957963
#pragma clang diagnostic pop
958964
#endif

0 commit comments

Comments
 (0)