diff --git a/.gitignore b/.gitignore index 0e268a8..2bb1cd8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ hkd* tests/parse tests/ioctl tests/evtest +tests/struct_init diff --git a/tests/makefile b/tests/makefile index 70a608f..59fb382 100644 --- a/tests/makefile +++ b/tests/makefile @@ -9,5 +9,7 @@ evtest: evtest.c inotify: inotify.c +struct_init: struct_init.c + clean: - rm *.o parse ioctl inotify 2> /dev/null + rm *.o parse ioctl inotify struct_init 2> /dev/null diff --git a/tests/struct_init.c b/tests/struct_init.c new file mode 100644 index 0000000..36b4f02 --- /dev/null +++ b/tests/struct_init.c @@ -0,0 +1,18 @@ +#include + +#define HELL 10 +#define IDE 220 +#define MAKE_ENTRY(value) {"value", value} +const struct { + const char * const name; + const unsigned short value; +} init[] = { +{"lol", 1}, +{"hello", HELL}, +MAKE_ENTRY(IDE) +}; + +int main (void) { + printf("%s\t%d\n", init[2].name, init[2].value); + return 0; +}