[libcxx-commits] [PATCH] D131929: [libcxx] Resolve warnings for Wimplicit-float-conversion, Wmacro-redefined, Wzero-as-null-pointer-constant, Wsign-conversion

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 16 02:31:59 PDT 2022


philnik requested changes to this revision.
philnik added a comment.
This revision now requires changes to proceed.

These warnings should be enabled in the test suite to avoid regressions.



================
Comment at: libcxx/include/cmath:534
 inline _LIBCPP_INLINE_VISIBILITY float       hypot(       float __x,       float __y,       float __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
-inline _LIBCPP_INLINE_VISIBILITY double      hypot(      double __x,      double __y,      double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
-inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double __x, long double __y, long double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
+inline _LIBCPP_INLINE_VISIBILITY double      hypot(      double __x,      double __y,      double __z ) { return sqrtf(__x*__x + __y*__y + __z*__z); }
+inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double __x, long double __y, long double __z ) { return sqrtl(__x*__x + __y*__y + __z*__z); }
----------------
What exactly is the problem here? `sqrt` has overloads for `float`, `double` and `long double`.


================
Comment at: libcxx/include/string_view:288
     typedef ptrdiff_t                                  difference_type;
-    static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
+    static _LIBCPP_CONSTEXPR const size_type npos = ~static_cast<size_type>(0U); // size_type(-1);
 
----------------
Maybe use numeric_limits here instead?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131929/new/

https://reviews.llvm.org/D131929



More information about the libcxx-commits mailing list