summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxhdrs
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 /testsuites/psxtests/psxhdrs
parentPOSIX Signature Test for arpa/inet.h (GCI2018) (diff)
downloadrtems-6acc556a8e46306ca5df22115a220601f216af88.tar.bz2
Implement POSIX API Signature Compliance Tests for stddef.h (GCI 2018)
Diffstat (limited to 'testsuites/psxtests/psxhdrs')
-rw-r--r--testsuites/psxtests/psxhdrs/stddef/offsetof.c38
1 files changed, 38 insertions, 0 deletions
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);
+}