|
16 | 16 | #include "src/__support/FPUtil/fpbits_str.h" |
17 | 17 | #include "src/__support/libc_errno.h" |
18 | 18 | #include "src/__support/macros/config.h" |
| 19 | +#include "src/__support/macros/optimization.h" |
19 | 20 | #include "src/__support/macros/properties/architectures.h" |
20 | 21 | #include "test/UnitTest/ErrnoCheckingTest.h" |
21 | 22 | #include "test/UnitTest/RoundingModeUtils.h" |
@@ -294,42 +295,46 @@ struct ModifyMXCSR { |
294 | 295 |
|
295 | 296 | #define EXPECT_MATH_ERRNO(expected) \ |
296 | 297 | do { \ |
297 | | - if (math_errhandling & MATH_ERRNO) { \ |
298 | | - int actual = libc_errno; \ |
299 | | - libc_errno = 0; \ |
300 | | - EXPECT_EQ(actual, expected); \ |
301 | | - } \ |
| 298 | + if ((LIBC_MATH & LIBC_MATH_NO_ERRNO) == 0) \ |
| 299 | + if (math_errhandling & MATH_ERRNO) { \ |
| 300 | + int actual = libc_errno; \ |
| 301 | + libc_errno = 0; \ |
| 302 | + EXPECT_EQ(actual, expected); \ |
| 303 | + } \ |
302 | 304 | } while (0) |
303 | 305 |
|
304 | 306 | #define ASSERT_MATH_ERRNO(expected) \ |
305 | 307 | do { \ |
306 | | - if (math_errhandling & MATH_ERRNO) { \ |
307 | | - int actual = libc_errno; \ |
308 | | - libc_errno = 0; \ |
309 | | - ASSERT_EQ(actual, expected); \ |
310 | | - } \ |
| 308 | + if ((LIBC_MATH & LIBC_MATH_NO_ERRNO) == 0) \ |
| 309 | + if (math_errhandling & MATH_ERRNO) { \ |
| 310 | + int actual = libc_errno; \ |
| 311 | + libc_errno = 0; \ |
| 312 | + ASSERT_EQ(actual, expected); \ |
| 313 | + } \ |
311 | 314 | } while (0) |
312 | 315 |
|
313 | 316 | #define EXPECT_FP_EXCEPTION(expected) \ |
314 | 317 | do { \ |
315 | | - if (math_errhandling & MATH_ERREXCEPT) { \ |
316 | | - EXPECT_EQ( \ |
317 | | - LIBC_NAMESPACE::fputil::test_except( \ |
318 | | - static_cast<int>(FE_ALL_EXCEPT)) & \ |
319 | | - ((expected) ? (expected) : static_cast<int>(FE_ALL_EXCEPT)), \ |
320 | | - (expected)); \ |
321 | | - } \ |
| 318 | + if ((LIBC_MATH & LIBC_MATH_NO_EXCEPT) == 0) \ |
| 319 | + if (math_errhandling & MATH_ERREXCEPT) { \ |
| 320 | + EXPECT_EQ( \ |
| 321 | + LIBC_NAMESPACE::fputil::test_except( \ |
| 322 | + static_cast<int>(FE_ALL_EXCEPT)) & \ |
| 323 | + ((expected) ? (expected) : static_cast<int>(FE_ALL_EXCEPT)), \ |
| 324 | + (expected)); \ |
| 325 | + } \ |
322 | 326 | } while (0) |
323 | 327 |
|
324 | 328 | #define ASSERT_FP_EXCEPTION(expected) \ |
325 | 329 | do { \ |
326 | | - if (math_errhandling & MATH_ERREXCEPT) { \ |
327 | | - ASSERT_EQ( \ |
328 | | - LIBC_NAMESPACE::fputil::test_except( \ |
329 | | - static_cast<int>(FE_ALL_EXCEPT)) & \ |
330 | | - ((expected) ? (expected) : static_cast<int>(FE_ALL_EXCEPT)), \ |
331 | | - (expected)); \ |
332 | | - } \ |
| 330 | + if ((LIBC_MATH & LIBC_MATH_NO_EXCEPT) == 0) \ |
| 331 | + if (math_errhandling & MATH_ERREXCEPT) { \ |
| 332 | + ASSERT_EQ( \ |
| 333 | + LIBC_NAMESPACE::fputil::test_except( \ |
| 334 | + static_cast<int>(FE_ALL_EXCEPT)) & \ |
| 335 | + ((expected) ? (expected) : static_cast<int>(FE_ALL_EXCEPT)), \ |
| 336 | + (expected)); \ |
| 337 | + } \ |
333 | 338 | } while (0) |
334 | 339 |
|
335 | 340 | #define EXPECT_FP_EQ_WITH_EXCEPTION(expected_val, actual_val, expected_except) \ |
|
0 commit comments