Add test for more tricky SIZEOF_* checks
This commit is contained in:
parent
2e1a2fe3c1
commit
a9d13e2519
@ -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
|
||||
* compile time.
|
||||
*/
|
||||
|
||||
#include <stdint.h> /* uint32_t */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/* Return:
|
||||
*
|
||||
* 0 if the runtime and compile time byte orders match
|
||||
|
2
libbuild2-autoconf-tests/checks/sizeof/.gitignore
vendored
Normal file
2
libbuild2-autoconf-tests/checks/sizeof/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
config.h
|
||||
driver
|
11
libbuild2-autoconf-tests/checks/sizeof/buildfile
Normal file
11
libbuild2-autoconf-tests/checks/sizeof/buildfile
Normal 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
|
||||
}
|
2
libbuild2-autoconf-tests/checks/sizeof/config.h.in
Normal file
2
libbuild2-autoconf-tests/checks/sizeof/config.h.in
Normal file
@ -0,0 +1,2 @@
|
||||
#undef SIZEOF_OFF_T
|
||||
#undef SIZEOF_PTHREAD_T
|
23
libbuild2-autoconf-tests/checks/sizeof/driver.c
Normal file
23
libbuild2-autoconf-tests/checks/sizeof/driver.c
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user