[libcxx-commits] [PATCH] D143033: [libc++] Disable some tests in `math_nodiscard_extensions`.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 31 16:48:12 PST 2023


var-const created this revision.
Herald added a project: All.
var-const requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Some functions in `math.h` in libc++ are deliberately written to make it
possible for a platform to override them. For example, `fabs` is defined
as (simplified):

  template <class = int>
  double fabs(double __x);

Due to the use of a template parameter, a non-template `fabs` function
with the same signature, if present, will be preferred by overload
resolution.

The platform-provided functions, if present, are not guaranteed to be
marked with `[[nodiscard]]`, making the test inapplicable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143033

Files:
  libcxx/test/libcxx/diagnostics/math_nodiscard_extensions.verify.cpp


Index: libcxx/test/libcxx/diagnostics/math_nodiscard_extensions.verify.cpp
===================================================================
--- libcxx/test/libcxx/diagnostics/math_nodiscard_extensions.verify.cpp
+++ libcxx/test/libcxx/diagnostics/math_nodiscard_extensions.verify.cpp
@@ -89,67 +89,67 @@
   std::isunordered(0U, 0U);      // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::ceil(0.f);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::ceil(0.);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::ceil(0.);                 // This overload might be overridden by a platform's `<math.h>`.
   std::ceil(0.l);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::ceil(0);                  // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::ceil(0U);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::fabs(0.f);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::fabs(0.);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::fabs(0.);                 // This overload might be overridden by a platform's `<math.h>`.
   std::fabs(0.l);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::fabs(0);                  // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::fabs(0U);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::floor(0.f);               // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::floor(0.);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::floor(0.);                // This overload might be overridden by a platform's `<math.h>`.
   std::floor(0.l);               // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::floor(0);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::floor(0U);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::cbrt(0.f);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::cbrt(0.);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::cbrt(0.);                 // This overload might be overridden by a platform's `<math.h>`.
   std::cbrt(0.l);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::cbrt(0);                  // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::cbrt(0U);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::copysign(0.f, 0.f);       // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::copysign(0., 0.);         // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::copysign(0., 0.);         // This overload might be overridden by a platform's `<math.h>`.
   std::copysign(0.l, 0.l);       // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::copysign(0, 0);           // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::copysign(0U, 0U);         // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::fmax(0.f, 0.f);           // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::fmax(0., 0.);             // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::fmax(0., 0.);             // This overload might be overridden by a platform's `<math.h>`.
   std::fmax(0.l, 0.l);           // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::fmax(0, 0);               // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::fmax(0U, 0U);             // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::fmin(0.f, 0.f);           // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::fmin(0., 0.);             // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::fmin(0., 0.);             // This overload might be overridden by a platform's `<math.h>`.
   std::fmin(0.l, 0.l);           // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::fmin(0, 0);               // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::fmin(0U, 0U);             // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::nearbyint(0.f);           // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::nearbyint(0.);            // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::nearbyint(0.);            // This overload might be overridden by a platform's `<math.h>`.
   std::nearbyint(0.l);           // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::nearbyint(0);             // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::nearbyint(0U);            // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::rint(0.f);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::rint(0.);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::rint(0.);                 // This overload might be overridden by a platform's `<math.h>`.
   std::rint(0.l);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::rint(0);                  // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::rint(0U);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::round(0.f);               // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::round(0.);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::round(0.);                // This overload might be overridden by a platform's `<math.h>`.
   std::round(0.l);               // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::round(0);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::round(0U);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
 
   std::trunc(0.f);               // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
-  std::trunc(0.);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+  std::trunc(0.);                // This overload might be overridden by a platform's `<math.h>`.
   std::trunc(0.l);               // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::trunc(0);                 // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
   std::trunc(0U);                // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143033.493777.patch
Type: text/x-patch
Size: 8474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230201/f019385f/attachment-0001.bin>


More information about the libcxx-commits mailing list