[rtems commit] Implement POSIX API Signature Compliance Tests for stddef.h (GCI 2018)

Joel Sherrill joel at rtems.org
Sat Dec 8 16:59:39 UTC 2018


Module:    rtems
Branch:    master
Commit:    6acc556a8e46306ca5df22115a220601f216af88
Changeset: http://git.rtems.org/rtems/commit/?id=6acc556a8e46306ca5df22115a220601f216af88

Author:    Marçal Comajoan Cara <mcomajoancara at gmail.com>
Date:      Fri Dec  7 17:48:11 2018 +0100

Implement POSIX API Signature Compliance Tests for stddef.h (GCI 2018)

---

 testsuites/psxtests/Makefile.am               |  1 +
 testsuites/psxtests/psxhdrs/stddef/offsetof.c | 38 +++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index f49cb91..e7727f8 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 0000000..b3c2a97
--- /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);
+}




More information about the vc mailing list