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

This commit is contained in:
Marçal Comajoan Cara
2018-12-07 17:48:11 +01:00
committed by Joel Sherrill
parent 100d87fad8
commit 6acc556a8e
2 changed files with 39 additions and 0 deletions

View File

@@ -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 \

View File

@@ -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);
}