[PATCH] Implement POSIX API Signature Compliance Tests for stddef.h
Marçal Comajoan Cara
mcomajoancara at gmail.com
Sat Dec 8 01:36:08 UTC 2018
This work was part of GCI 2018.
---
testsuites/psxtests/Makefile.am | 3 +-
testsuites/psxtests/psxhdrs/stddef/offsetof.c | 38 +++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 testsuites/psxtests/psxhdrs/stddef/offsetof.c
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 1ac5a31df4..887849368f 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1579,7 +1579,8 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
psxhdrs/inttypes/strtoimax.c \
psxhdrs/inttypes/strtoumax.c \
psxhdrs/inttypes/wcstoimax.c \
- psxhdrs/inttypes/wcstoumax.c
+ psxhdrs/inttypes/wcstoumax.c \
+ psxhdrs/stddef/offsetof.c
## Not supported by RTEMS, but POSIX API Compliance tests exist.
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);
+}
--
2.19.2
More information about the devel
mailing list