build: fix warnings when building with clang
authorBartosz Golaszewski <bartekgola@gmail.com>
Wed, 4 Oct 2017 09:23:08 +0000 (11:23 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Wed, 4 Oct 2017 09:23:08 +0000 (11:23 +0200)
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 <bartekgola@gmail.com>
src/tools/gpiodetect.c
src/tools/gpiofind.c
src/tools/gpioget.c
src/tools/gpioinfo.c
src/tools/gpiomon.c
src/tools/gpioset.c
src/tools/tools-common.h

index aa50b16948802aa091711a52eddbdd09f9a1beeb..94163c6544962a2edbb520e1a17457fc72abcff1 100644 (file)
@@ -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";
index 15a62786f06564843ea64de06e3cea7e86ecec2d..da756dbaf7efb80f98949f16e00af46f92c15c36 100644 (file)
@@ -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";
index 2cf081b5b3e13f9203bf868e5407ad8bb8cd2ea5..fba161ca055f46ad94d5a9b95d8c173ae866d4e0 100644 (file)
@@ -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";
index 9d83d591c3c02bef5cf79d38d7f1fc2c4a345014..0dda38ce49eb5849ed9d1193a6f1f3c31036875b 100644 (file)
@@ -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";
index ab84a0d501d813c3c8cfa94b1b62b1609ceb480e..d54234dd4951b3d23e0d6db3dd1bed10fafa8ccd 100644 (file)
@@ -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:";
index b0d60edb69a2b440d1d8ac9b181af16b46fb519b..5a62c0b834319c6e6722cb371aba3b14af959b71 100644 (file)
@@ -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";
index 78c7cd210caee5a7b0daf732040fcdf7c65430a8..2a0dd6614d06dc82ab893db2e934a0365886888d 100644 (file)
@@ -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, ...);