diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -568,9 +568,15 @@ else() target_add_compile_flags_if_supported(${target} PRIVATE -Wall) endif() - target_add_compile_flags_if_supported(${target} PRIVATE -Wextra -W -Wwrite-strings - -Wno-unused-parameter -Wno-long-long - -Werror=return-type -Wextra-semi -Wundef + target_add_compile_flags_if_supported(${target} PRIVATE -Wextra + -W + -Wwrite-strings + -Wno-unused-parameter + -Wno-long-long + -Werror=return-type + -Wextra-semi + -Wundef + -Wunused-template -Wformat-nonliteral) if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") target_add_compile_flags_if_supported(${target} PRIVATE diff --git a/libcxx/include/__algorithm/make_projected.h b/libcxx/include/__algorithm/make_projected.h --- a/libcxx/include/__algorithm/make_projected.h +++ b/libcxx/include/__algorithm/make_projected.h @@ -60,7 +60,7 @@ __enable_if_t::type>::value && __is_identity::type>::value), int> = 0> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static _ProjectedPred<_Pred, _Proj> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR inline _ProjectedPred<_Pred, _Proj> __make_projected(_Pred& __pred, _Proj& __proj) { return _ProjectedPred<_Pred, _Proj>(__pred, __proj); } @@ -73,7 +73,7 @@ __enable_if_t::type>::value && __is_identity::type>::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static _Pred& __make_projected(_Pred& __pred, _Proj&) { +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR inline _Pred& __make_projected(_Pred& __pred, _Proj&) { return __pred; } @@ -86,7 +86,7 @@ namespace ranges { template -_LIBCPP_HIDE_FROM_ABI constexpr static +_LIBCPP_HIDE_FROM_ABI constexpr inline decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) { if constexpr (__is_identity>::value && __is_identity>::value && !is_member_pointer_v>) { diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1251,13 +1251,13 @@ // macro is used to mark them as such, which suppresses the // '-Wctad-maybe-unsupported' compiler warning when CTAD is used in user code // with these classes. -#if _LIBCPP_STD_VER >= 17 +# if _LIBCPP_STD_VER >= 17 # define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \ - template \ - _ClassName(typename _Tag::__allow_ctad...) -> _ClassName<_Tag...> -#else -# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") -#endif + template \ + [[maybe_unused]] _ClassName(typename _Tag::__allow_ctad...)->_ClassName<_Tag...> +# else +# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") +# endif #endif // __cplusplus diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h --- a/libcxx/include/__memory/shared_ptr.h +++ b/libcxx/include/__memory/shared_ptr.h @@ -433,10 +433,10 @@ template ()(std::declval<_Pt>()))> -static true_type __well_formed_deleter_test(int); +inline true_type __well_formed_deleter_test(int); template -static false_type __well_formed_deleter_test(...); +inline false_type __well_formed_deleter_test(...); template struct __well_formed_deleter : decltype(std::__well_formed_deleter_test<_Dp, _Pt>(0)) {}; diff --git a/libcxx/include/__type_traits/is_nothrow_convertible.h b/libcxx/include/__type_traits/is_nothrow_convertible.h --- a/libcxx/include/__type_traits/is_nothrow_convertible.h +++ b/libcxx/include/__type_traits/is_nothrow_convertible.h @@ -27,10 +27,10 @@ #if _LIBCPP_STD_VER >= 20 template -static void __test_noexcept(_Tp) noexcept; +inline void __test_noexcept(_Tp) noexcept; template -static bool_constant(std::declval<_Fm>()))> +inline bool_constant(std::declval<_Fm>()))> __is_nothrow_convertible_test(); template diff --git a/libcxx/src/filesystem/filesystem_common.h b/libcxx/src/filesystem/filesystem_common.h --- a/libcxx/src/filesystem/filesystem_common.h +++ b/libcxx/src/filesystem/filesystem_common.h @@ -44,9 +44,11 @@ #endif #endif +// TODO: Check whether these functions actually need internal linkage, or if they can be made normal header functions _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wunused-function") _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-function") +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-template") #if defined(_LIBCPP_WIN32API) # define PATHSTR(x) (L##x) diff --git a/libcxx/test/std/time/time.hms/time.hms.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.hms/time.hms.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.hms/time.hms.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.hms/time.hms.nonmembers/ostream.pass.cpp @@ -53,15 +53,6 @@ return sstr.str(); } -template -static std::basic_string stream_ja_JP_locale(std::chrono::hh_mm_ss hms) { - std::basic_stringstream sstr; - const std::locale locale(LOCALE_ja_JP_UTF_8); - sstr.imbue(locale); - sstr << hms; - return sstr.str(); -} - template static void test() { // Note std::atto can't be tested since the ratio conversion from std::atto diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -17,6 +17,7 @@ '-Wextra', '-Wshadow', '-Wundef', + '-Wunused-template', '-Wno-unused-command-line-argument', '-Wno-attributes', '-Wno-pessimizing-move',