[Piglit] [PATCH 2/3] tests: Use FE_UPWARD only if its defined in fenv.h

Ross Burton ross.burton at intel.com
Fri Nov 30 10:45:05 UTC 2018


From: Khem Raj <raj.khem at gmail.com>

On ARM, musl does not define FE_* when arch does not have
VFP, (which is right interpretation), therefore check if
it is defined before using it.

Fixes errors like:

tests/general/roundmode-pixelstore.c:82:19: error: 'FE_UPWARD' undeclared (first use in this function)
  ret = fesetround(FE_UPWARD);
                   ^~~~~~~~~

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 tests/general/roundmode-getintegerv.c | 2 ++
 tests/general/roundmode-pixelstore.c  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/tests/general/roundmode-getintegerv.c b/tests/general/roundmode-getintegerv.c
index 28ecfaf55..5c275797b 100644
--- a/tests/general/roundmode-getintegerv.c
+++ b/tests/general/roundmode-getintegerv.c
@@ -81,7 +81,9 @@ piglit_init(int argc, char **argv)
 {
 	int ret;
 	bool pass = true;
+#ifdef FE_UPWARD
 	ret = fesetround(FE_UPWARD);
+#endif
 	if (ret != 0) {
 		printf("Couldn't set rounding mode\n");
 		piglit_report_result(PIGLIT_SKIP);
diff --git a/tests/general/roundmode-pixelstore.c b/tests/general/roundmode-pixelstore.c
index 8a029b257..51951a0d9 100644
--- a/tests/general/roundmode-pixelstore.c
+++ b/tests/general/roundmode-pixelstore.c
@@ -81,7 +81,9 @@ piglit_init(int argc, char **argv)
 {
 	int ret;
 	bool pass = true;
+#ifdef FE_UPWARD
 	ret = fesetround(FE_UPWARD);
+#endif
 	if (ret != 0) {
 		printf("Couldn't set rounding mode\n");
 		piglit_report_result(PIGLIT_SKIP);
-- 
2.11.0



More information about the Piglit mailing list