From 6acc556a8e46306ca5df22115a220601f216af88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=A7al=20Comajoan=20Cara?= Date: Fri, 7 Dec 2018 17:48:11 +0100 Subject: Implement POSIX API Signature Compliance Tests for stddef.h (GCI 2018) --- testsuites/psxtests/psxhdrs/stddef/offsetof.c | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 testsuites/psxtests/psxhdrs/stddef/offsetof.c (limited to 'testsuites/psxtests/psxhdrs') 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 + +int test( void ); + +int test( void ) +{ + struct S { + char c; + double d; + }; + + return offsetof(struct S, d); +} -- cgit v1.2.3