Add STDC FENV_ACCESS ON pragma

This is required by the C99 standard, even though it's not
needed by the compilers we support.
This commit is contained in:
Luca Bacci 2025-02-04 11:34:20 +01:00
parent 658c7a721d
commit 2f34598297
3 changed files with 28 additions and 0 deletions

View file

@ -153,6 +153,30 @@
#define __attribute__(x)
#endif
#if defined(__clang__)
# if __clang_major__ >= 12
# define CAIRO_FENV_ACCESS_ON _Pragma ("STDC FENV_ACCESS ON")
# else
# define CAIRO_FENV_ACCESS_ON
# endif
#elif defined(__GNUC__)
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118838 */
# if __GNUC__ >= 16
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34678 */
# define CAIRO_FENV_ACCESS_ON \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wunknown-pragmas\"") \
_Pragma ("STDC FENV_ACCESS ON") \
_Pragma ("GCC diagnostic pop")
# else
# define CAIRO_FENV_ACCESS_ON
# endif
#elif defined(_MSC_VER)
# define CAIRO_FENV_ACCESS_ON __pragma (fenv_access (on))
#else
# define CAIRO_FENV_ACCESS_ON _Pragma ("STDC FENV_ACCESS ON")
#endif
#if (defined(__WIN32__) && !defined(__WINE__)) || defined(_MSC_VER)
#define access _access
#ifndef R_OK

View file

@ -83,6 +83,8 @@
#define alarm(X);
#endif
CAIRO_FENV_ACCESS_ON
static const cairo_user_data_key_t _cairo_test_context_key;
static void

View file

@ -33,6 +33,8 @@
#define INFINITY HUGE_VAL
#endif
CAIRO_FENV_ACCESS_ON
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{