Add test for more tricky SIZEOF_* checks

This commit is contained in:
Boris Kolpackov 2022-09-04 12:35:01 +02:00
parent 2e1a2fe3c1
commit a9d13e2519
5 changed files with 42 additions and 4 deletions

View File

@ -1,11 +1,11 @@
#include <stdint.h> // uint32_t
#include "config.h"
/* Test that the byte order detected at runtime matches the one detected at /* Test that the byte order detected at runtime matches the one detected at
* compile time. * compile time.
*/ */
#include <stdint.h> /* uint32_t */
#include "config.h"
/* Return: /* Return:
* *
* 0 if the runtime and compile time byte orders match * 0 if the runtime and compile time byte orders match

View File

@ -0,0 +1,2 @@
config.h
driver

View File

@ -0,0 +1,11 @@
exe{driver}: c{driver} h{config}
h{config}: in{config}
c.poptions += "-I$out_base"
if ($c.target.system != 'win32-msvc')
{
c.libs += -pthread
c.poptions += -DTEST_PTHREAD
}

View File

@ -0,0 +1,2 @@
#undef SIZEOF_OFF_T
#undef SIZEOF_PTHREAD_T

View File

@ -0,0 +1,23 @@
/* Test more tricky SIZEOF_* checks.
*/
#include "config.h"
#include <sys/types.h> /* off_t */
#ifdef TEST_PTHREAD
# include <pthread.h>
#endif
#undef NDEBUG
#include <assert.h>
int
main ()
{
assert (SIZEOF_OFF_T == sizeof (off_t));
#ifdef TEST_PTHREAD
assert (SIZEOF_PTHREAD_T == sizeof (pthread_t));
#endif
}