[Pixman] [PATCH] test/utils: Check for FE_INVALID definition before use

Siarhei Siamashka siarhei.siamashka at gmail.com
Mon Jun 6 02:42:49 UTC 2016

On Tue, 17 May 2016 17:32:00 -0700
Khem Raj <raj.khem at gmail.com> wrote:

> Some architectures e.g. nios2 do not support all exceptions
> Signed-off-by: Khem Raj <raj.khem at gmail.com>
> ---
>  test/utils.c | 2 ++
>  1 file changed, 2 insertions(+)
> diff --git a/test/utils.c b/test/utils.c
> index f8e42a5..fe32b1e 100644
> --- a/test/utils.c
> +++ b/test/utils.c
> @@ -978,9 +978,11 @@ enable_invalid_exceptions (void)
>  {
>  #ifdef HAVE_FENV_H
> +#ifdef FE_INVALID
>      feenableexcept (FE_INVALID);
>  #endif
>  #endif
> +#endif
>  }
>  void *


I think that we have seen this problem reported earlier, but the
proposed "fix" was an attempt to just disable compiling tests

I'm glad that the root cause is finally getting properly addressed.
But before we can apply your patch, please change it to look like

The reason is that such #ifdef based checks are not always reliable. We
never know what kind of stunts may be hidden in the header files on
various platforms and operating systems. And we already had been
surprised more than once. This is an artificial example, but please
consider the following code:

$ cat test.c 
static const int SOMETHING_THAT_LOOKS_LIKE_A_DEFINE = 123;

#error SOMETHING_THAT_LOOKS_LIKE_A_DEFINE seems to be available
#error SOMETHING_THAT_LOOKS_LIKE_A_DEFINE seems to be not available

$ gcc test.c
test.c:7:2: error: #error SOMETHING_THAT_LOOKS_LIKE_A_DEFINE seems to be not available
 #error SOMETHING_THAT_LOOKS_LIKE_A_DEFINE seems to be not available


More information about the Pixman mailing list