Files
Nicholas Piggin 10d50007fb ccan: sync to upstream ccan.git commit ca7c5a9e04f3
sync to upstream ccan.git commit ca7c5a9e04f3 ("ccan: make tal_dump()
format more regular.").

The recipe used to sync upstream is:

 $ cd ccan
 $ ./tools/create-ccan-tree -b make tmp \
     array_size check_type container_of heap \
     short_types build_assert endian list str
 $ # replace directories in skiboot/ccan/ with those in tmp/ccan/
 $ cd ../skiboot
 $ patch -p1 < ccan/skiboot.patch

This also adds a README.skiboot to help with future updates.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2021-12-09 11:09:01 +01:00

34 lines
743 B
C

#include <ccan/array_size/array_size.h>
#include <ccan/tap/tap.h>
static char array1[1];
static int array2[2];
static unsigned long array3[3][5];
struct foo {
unsigned int a, b;
char string[100];
};
static struct foo array4[4];
/* Make sure they can be used in initializers. */
static int array1_size = ARRAY_SIZE(array1);
static int array2_size = ARRAY_SIZE(array2);
static int array3_size = ARRAY_SIZE(array3);
static int array4_size = ARRAY_SIZE(array4);
int main(void)
{
plan_tests(8);
ok1(array1_size == 1);
ok1(array2_size == 2);
ok1(array3_size == 3);
ok1(array4_size == 4);
ok1(ARRAY_SIZE(array1) == 1);
ok1(ARRAY_SIZE(array2) == 2);
ok1(ARRAY_SIZE(array3) == 3);
ok1(ARRAY_SIZE(array4) == 4);
return exit_status();
}