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

Eric Engestrom eric.engestrom at intel.com
Fri Nov 30 12:37:42 UTC 2018


On Friday, 2018-11-30 10:45:05 +0000, Ross Burton wrote:
> 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) {

You'll need a #else that sets ret, otherwise you're pretty obviously
going to jump based on an uninitialised variable here :/

>  		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
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list