Fix arm/arm64 <fenv.h> to match current reality.
ARM stopped supporting enabling of FP exceptions years ago.
Bug: http://b/68832485
Test: ran tests
Change-Id: I8450baa78e04d994c352180975b0a1ecd5a9f662
diff --git a/tests/fenv_test.cpp b/tests/fenv_test.cpp
index c914692..9fc7d96 100644
--- a/tests/fenv_test.cpp
+++ b/tests/fenv_test.cpp
@@ -182,12 +182,20 @@
TEST(fenv, feenableexcept_fegetexcept) {
#if defined(__aarch64__) || defined(__arm__)
- // Unsupported.
- // arm:
- // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.100403_0200_00_en/lau1442504290459.html
- // aarch64:
- // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0488h/way1382990760439.html
- GTEST_LOG_(INFO) << "arm and arm64 don't support feenableexcept";
+ // ARM doesn't support this. They used to if you go back far enough, but it was removed in
+ // the Cortex-A8 between r3p1 and r3p2.
+ ASSERT_EQ(-1, feenableexcept(FE_INVALID));
+ ASSERT_EQ(0, fegetexcept());
+ ASSERT_EQ(-1, feenableexcept(FE_DIVBYZERO));
+ ASSERT_EQ(0, fegetexcept());
+ ASSERT_EQ(-1, feenableexcept(FE_OVERFLOW));
+ ASSERT_EQ(0, fegetexcept());
+ ASSERT_EQ(-1, feenableexcept(FE_UNDERFLOW));
+ ASSERT_EQ(0, fegetexcept());
+ ASSERT_EQ(-1, feenableexcept(FE_INEXACT));
+ ASSERT_EQ(0, fegetexcept());
+ ASSERT_EQ(-1, feenableexcept(FE_DENORMAL));
+ ASSERT_EQ(0, fegetexcept());
#else
// We can't recover from SIGFPE, so sacrifice a child...
pid_t pid = fork();