From: Bartosz Golaszewski Date: Wed, 4 Oct 2017 09:23:08 +0000 (+0200) Subject: build: fix warnings when building with clang X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=34a2f58aeceaa108db02e119651641def305c651;p=qemu-gpiodev%2Flibgpiod.git build: fix warnings when building with clang Clang complains about "missing field 'has_arg' initializer" when zeroing the last element of the struct option array with "{ 0 }". Use a complete initializer to fix this warning. Signed-off-by: Bartosz Golaszewski --- diff --git a/src/tools/gpiodetect.c b/src/tools/gpiodetect.c index aa50b16..94163c6 100644 --- a/src/tools/gpiodetect.c +++ b/src/tools/gpiodetect.c @@ -18,7 +18,7 @@ static const struct option longopts[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' }, - { 0 }, + { GETOPT_NULL_LONGOPT }, }; static const char *const shortopts = "+hv"; diff --git a/src/tools/gpiofind.c b/src/tools/gpiofind.c index 15a6278..da756db 100644 --- a/src/tools/gpiofind.c +++ b/src/tools/gpiofind.c @@ -18,7 +18,7 @@ static const struct option longopts[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' }, - { 0 }, + { GETOPT_NULL_LONGOPT }, }; static const char *const shortopts = "+hv"; diff --git a/src/tools/gpioget.c b/src/tools/gpioget.c index 2cf081b..fba161c 100644 --- a/src/tools/gpioget.c +++ b/src/tools/gpioget.c @@ -20,7 +20,7 @@ static const struct option longopts[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' }, { "active-low", no_argument, NULL, 'l' }, - { 0 }, + { GETOPT_NULL_LONGOPT }, }; static const char *const shortopts = "+hvl"; diff --git a/src/tools/gpioinfo.c b/src/tools/gpioinfo.c index 9d83d59..0dda38c 100644 --- a/src/tools/gpioinfo.c +++ b/src/tools/gpioinfo.c @@ -40,7 +40,7 @@ static const struct flag flags[] = { static const struct option longopts[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' }, - { 0 }, + { GETOPT_NULL_LONGOPT }, }; static const char *const shortopts = "+hv"; diff --git a/src/tools/gpiomon.c b/src/tools/gpiomon.c index ab84a0d..d54234d 100644 --- a/src/tools/gpiomon.c +++ b/src/tools/gpiomon.c @@ -30,7 +30,7 @@ static const struct option longopts[] = { { "rising-edge", no_argument, NULL, 'r' }, { "falling-edge", no_argument, NULL, 'f' }, { "format", required_argument, NULL, 'F' }, - { 0 }, + { GETOPT_NULL_LONGOPT }, }; static const char *const shortopts = "+hvln:srfF:"; diff --git a/src/tools/gpioset.c b/src/tools/gpioset.c index b0d60ed..5a62c0b 100644 --- a/src/tools/gpioset.c +++ b/src/tools/gpioset.c @@ -30,7 +30,7 @@ static const struct option longopts[] = { { "sec", required_argument, NULL, 's' }, { "usec", required_argument, NULL, 'u' }, { "background", no_argument, NULL, 'b' }, - { 0 }, + { GETOPT_NULL_LONGOPT }, }; static const char *const shortopts = "+hvlm:s:u:b"; diff --git a/src/tools/tools-common.h b/src/tools/tools-common.h index 78c7cd2..2a0dd66 100644 --- a/src/tools/tools-common.h +++ b/src/tools/tools-common.h @@ -21,6 +21,8 @@ #define PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) +#define GETOPT_NULL_LONGOPT NULL, 0, NULL, 0 + const char * get_progname(void); void die(const char *fmt, ...); void die_perror(const char *fmt, ...);