From 6d9ef3245dfc8cbcc2e1d3f28e05090f1ed766a8 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 1 Mar 2019 21:49:01 -0500 Subject: skeletons for C11/C18 functions --- Makefile | 5 +++++ main.c | 10 +++++----- stdalign.c | 22 ++++++++++++++++++++++ stdatomic.c | 18 ++++++++++++++++++ stdnoreturn.c | 23 +++++++++++++++++++++++ threads.c | 18 ++++++++++++++++++ uchar.c | 23 +++++++++++++++++++++++ 7 files changed, 114 insertions(+), 5 deletions(-) create mode 100644 stdalign.c create mode 100644 stdatomic.c create mode 100644 stdnoreturn.c create mode 100644 threads.c create mode 100644 uchar.c diff --git a/Makefile b/Makefile index 9d75446..8b06b28 100644 --- a/Makefile +++ b/Makefile @@ -20,15 +20,20 @@ TESTOBJS=main.o \ math.o \ setjmp.o \ signal.o \ + stdalign.o \ stdarg.o \ + stdatomic.o \ stdbool.o \ stddef.o \ stdint.o \ stdio.o \ stdlib.o \ + stdnoreturn.o \ string.o \ tgmath.o \ + threads.o \ time.o \ + uchar.o \ wchar.o \ wctype.o \ test.o diff --git a/main.c b/main.c index a7444d9..8c6de36 100644 --- a/main.c +++ b/main.c @@ -52,20 +52,20 @@ int main(int argc, char *argv[]) test_math_h(); /* test_setjmp_h(); */ test_signal_h(); - /* test_stdalign_h(); */ + test_stdalign_h(); test_stdarg_h(); - /* test_stdatomic_h(); */ + test_stdatomic_h(); test_stdbool_h(); test_stddef_h(); test_stdint_h(); test_stdio_h(); test_stdlib_h(); - /* test_stdnoreturn_h(); */ + test_stdnoreturn_h(); test_string_h(); test_tgmath_h(); - /* test_threads_h(); */ + test_threads_h(); test_time_h(); - /* test_uchar_h(); */ + test_uchar_h(); test_wchar_h(); test_wctype_h(); diff --git a/stdalign.c b/stdalign.c new file mode 100644 index 0000000..9fd58bc --- /dev/null +++ b/stdalign.c @@ -0,0 +1,22 @@ +#if defined __STDC_VERSION__ && 201112L <= __STDC_VERSION__ +#include +#include "test.h" + +void test_stdalign_h(void) +{ + testing_header("stdalign.h"); + + /* alignas() */ + /* alignof() */ + + test_defined(__alignas_is_defined); + test_defined(__alignof_is_defined); + + testing_end(); +} + +#else +void test_stdalign_h(void) +{ +} +#endif diff --git a/stdatomic.c b/stdatomic.c new file mode 100644 index 0000000..932b8b5 --- /dev/null +++ b/stdatomic.c @@ -0,0 +1,18 @@ +#if defined __STDC_VERSION__ && 201112L <= __STDC_VERSION__ && ! defined __STDC_NO_ATOMICS__ +#include +#include "test.h" + +void test_stdatomic_h(void) +{ + testing_header("stdatomic.h"); + + /* TODO */ + + testing_end(); +} + +#else +void test_stdatomic_h(void) +{ +} +#endif diff --git a/stdnoreturn.c b/stdnoreturn.c new file mode 100644 index 0000000..1b73017 --- /dev/null +++ b/stdnoreturn.c @@ -0,0 +1,23 @@ +#if defined __STDC_VERSION__ && 201112L <= __STDC_VERSION__ +#include +#include "test.h" + +noreturn void foo(void) +{ + for (;;); +} + +void test_stdnoreturn_h(void) +{ + testing_header(".h"); + + /* tested by the fact that this compiles */ + + testing_end(); +} + +#else +void test_stdnoreturn_h(void) +{ +} +#endif diff --git a/threads.c b/threads.c new file mode 100644 index 0000000..abc2629 --- /dev/null +++ b/threads.c @@ -0,0 +1,18 @@ +#if defined __STDC_VERSION__ && 201112L <= __STDC_VERSION__ && ! defined __STDC_NO_THREADS__ +#include +#include "test.h" + +void test_threads_h(void) +{ + testing_header("threads.h"); + + /* TODO */ + + testing_end(); +} + +#else +void test_threads_h(void) +{ +} +#endif diff --git a/uchar.c b/uchar.c new file mode 100644 index 0000000..80e9234 --- /dev/null +++ b/uchar.c @@ -0,0 +1,23 @@ +#if defined __STDC_VERSION__ && 201112L <= __STDC_VERSION__ +#include +#include "test.h" + +void test_uchar_h(void) +{ + mbstate_t mbstate; + size_t size; + char16_t char16; + char32_t char32; + + testing_header("uchar.h"); + + /* TODO */ + + testing_end(); +} + +#else +void test_uchar_h(void) +{ +} +#endif -- cgit v1.2.1