summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarçal Comajoan Cara <mcomajoancara@gmail.com>2018-12-07 17:48:11 +0100
committerJoel Sherrill <joel@rtems.org>2018-12-08 10:57:50 -0600
commit6acc556a8e46306ca5df22115a220601f216af88 (patch)
treee49d1dfbd6178a77e0f148572b3414c652c348ee
parentPOSIX Signature Test for arpa/inet.h (GCI2018) (diff)
downloadrtems-6acc556a8e46306ca5df22115a220601f216af88.tar.bz2
Implement POSIX API Signature Compliance Tests for stddef.h (GCI 2018)
-rw-r--r--testsuites/psxtests/Makefile.am1
-rw-r--r--testsuites/psxtests/psxhdrs/stddef/offsetof.c38
2 files changed, 39 insertions, 0 deletions
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index f49cb918f7..e7727f80a4 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1304,6 +1304,7 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
psxhdrs/semaphore/sem_wait.c \
psxhdrs/semaphore/sem_trywait.c \
psxhdrs/semaphore/sem_timedwait.c \
+ psxhdrs/stddef/offsetof.c \
psxhdrs/stdio/clearerr.c \
psxhdrs/stdio/ctermid.c \
psxhdrs/stdio/dprintf.c \
diff --git a/testsuites/psxtests/psxhdrs/stddef/offsetof.c b/testsuites/psxtests/psxhdrs/stddef/offsetof.c
new file mode 100644
index 0000000000..b3c2a97c71
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/stddef/offsetof.c
@@ -0,0 +1,38 @@
+/**
+ * @file
+ * @brief offsetof() API Conformance Test
+ */
+
+/*
+ * COPYRIGHT (c) 2018.
+ * Marçal Comajoan Cara
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stddef.h>
+
+int test( void );
+
+int test( void )
+{
+ struct S {
+ char c;
+ double d;
+ };
+
+ return offsetof(struct S, d);
+}