| 1 |
/* Test *_IS_IEC_60559 macros. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-std=c23 -pedantic-errors" } */ |
| 4 |
|
| 5 |
#include <float.h> |
| 6 |
|
| 7 |
#ifndef FLT_IS_IEC_60559 |
| 8 |
#error "FLT_IS_IEC_60559 undefined" |
| 9 |
#endif |
| 10 |
|
| 11 |
#ifndef DBL_IS_IEC_60559 |
| 12 |
#error "DBL_IS_IEC_60559 undefined" |
| 13 |
#endif |
| 14 |
|
| 15 |
#ifndef LDBL_IS_IEC_60559 |
| 16 |
#error "LDBL_IS_IEC_60559 undefined" |
| 17 |
#endif |
| 18 |
|
| 19 |
#if defined __pdp11__ || defined __vax__ |
| 20 |
_Static_assert (FLT_IS_IEC_60559 == 0); |
| 21 |
_Static_assert (DBL_IS_IEC_60559 == 0); |
| 22 |
_Static_assert (LDBL_IS_IEC_60559 == 0); |
| 23 |
#else |
| 24 |
_Static_assert (FLT_IS_IEC_60559 == 1); |
| 25 |
_Static_assert (DBL_IS_IEC_60559 == 1); |
| 26 |
#if LDBL_MANT_DIG == 106 || LDBL_MIN_EXP == -16382 |
| 27 |
/* IBM long double and m68k extended format do not meet the definition |
| 28 |
of an IEC 60559 interchange or extended format. */ |
| 29 |
_Static_assert (LDBL_IS_IEC_60559 == 0); |
| 30 |
#else |
| 31 |
_Static_assert (LDBL_IS_IEC_60559 == 1); |
| 32 |
#endif |
| 33 |
#endif |