From b2efbbcdbbb3fa4a9cb2f80359f4e1b24116239e Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 8 Aug 2019 14:18:15 -0400 Subject: use better #ifdef tests --- _float.d | 9 +++++++++ _math.d | 1 + _math.h | 3 +++ _stdalign.d | 2 ++ _stdalign.h | 6 ++++++ _stdnoreturn.d | 1 + _stdnoreturn.h | 3 +++ float.d | 9 --------- math.c | 2 +- stdalign.c | 1 + stdnoreturn.c | 7 +------ 11 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 _float.d create mode 100644 _math.d create mode 100644 _math.h create mode 100644 _stdalign.d create mode 100644 _stdalign.h create mode 100644 _stdnoreturn.d create mode 100644 _stdnoreturn.h delete mode 100644 float.d diff --git a/_float.d b/_float.d new file mode 100644 index 0000000..12b21de --- /dev/null +++ b/_float.d @@ -0,0 +1,9 @@ +DBL_MANT_DIG +DBL_MAX_EXP +DBL_MIN_EXP +FLT_MANT_DIG +FLT_MAX_EXP +FLT_MIN_EXP +LDBL_MANT_DIG +LDBL_MAX_EXP +LDBL_MIN_EXP diff --git a/_math.d b/_math.d new file mode 100644 index 0000000..d4ad484 --- /dev/null +++ b/_math.d @@ -0,0 +1 @@ +HUGE_VAL diff --git a/_math.h b/_math.h new file mode 100644 index 0000000..8183947 --- /dev/null +++ b/_math.h @@ -0,0 +1,3 @@ +#ifndef HUGE_VAL +#error HUGE_VAL not defined +#endif diff --git a/_stdalign.d b/_stdalign.d new file mode 100644 index 0000000..0f2a6c7 --- /dev/null +++ b/_stdalign.d @@ -0,0 +1,2 @@ +alignas +alignof diff --git a/_stdalign.h b/_stdalign.h new file mode 100644 index 0000000..58287dd --- /dev/null +++ b/_stdalign.h @@ -0,0 +1,6 @@ +#ifndef alignas +#error alignas not defined +#endif +#ifndef alignof +#error alignof not defined +#endif diff --git a/_stdnoreturn.d b/_stdnoreturn.d new file mode 100644 index 0000000..b05ce94 --- /dev/null +++ b/_stdnoreturn.d @@ -0,0 +1 @@ +noreturn diff --git a/_stdnoreturn.h b/_stdnoreturn.h new file mode 100644 index 0000000..b415a00 --- /dev/null +++ b/_stdnoreturn.h @@ -0,0 +1,3 @@ +#ifndef noreturn +#error noreturn not defined +#endif diff --git a/float.d b/float.d deleted file mode 100644 index 12b21de..0000000 --- a/float.d +++ /dev/null @@ -1,9 +0,0 @@ -DBL_MANT_DIG -DBL_MAX_EXP -DBL_MIN_EXP -FLT_MANT_DIG -FLT_MAX_EXP -FLT_MIN_EXP -LDBL_MANT_DIG -LDBL_MAX_EXP -LDBL_MIN_EXP diff --git a/math.c b/math.c index 3cf65e6..8db3d1e 100644 --- a/math.c +++ b/math.c @@ -1,4 +1,5 @@ #include +#include "_math.h" #include "test.h" void test_math_h(void) @@ -15,7 +16,6 @@ void test_math_h(void) testing_header("math.h"); - test_defined(HUGE_VAL); test_double(acos(1), 0); test_double(asin(1), 0); test_double(atan(1), 0); diff --git a/stdalign.c b/stdalign.c index 9fd58bc..3cb7494 100644 --- a/stdalign.c +++ b/stdalign.c @@ -1,5 +1,6 @@ #if defined __STDC_VERSION__ && 201112L <= __STDC_VERSION__ #include +#include "_stdalign.h" #include "test.h" void test_stdalign_h(void) diff --git a/stdnoreturn.c b/stdnoreturn.c index 1b73017..44cd2f1 100644 --- a/stdnoreturn.c +++ b/stdnoreturn.c @@ -2,14 +2,9 @@ #include #include "test.h" -noreturn void foo(void) -{ - for (;;); -} - void test_stdnoreturn_h(void) { - testing_header(".h"); + testing_header("stdnoreturn.h"); /* tested by the fact that this compiles */ -- cgit v1.2.1