From: Florian Forster Date: Wed, 16 Feb 2011 08:45:35 +0000 (+0100) Subject: src/oping.c: Fix a compiler warning about uninitialized variables. X-Git-Tag: liboping-1.6.1~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b1ef1b502da11c03a4fbfb228abd017bd2aec613;p=liboping.git src/oping.c: Fix a compiler warning about uninitialized variables. Some verions of GGC don't notice that usage_qos_exit() won't return and complain about the variables "prec" and "class" being used uninitalized. This commit adds the "noreturn" attribute to that function and initializes the variables. Thanks to James Bromberger for reporting this problem. --- diff --git a/src/oping.c b/src/oping.c index 7058ac0..5ecfdbf 100644 --- a/src/oping.c +++ b/src/oping.c @@ -273,6 +273,7 @@ static void usage_exit (const char *name, int status) /* {{{ */ exit (status); } /* }}} void usage_exit */ +__attribute__((noreturn)) static void usage_qos_exit (const char *arg, int status) /* {{{ */ { if (arg != 0) @@ -334,8 +335,8 @@ static int set_opt_send_qos (const char *opt) /* {{{ */ && (strlen (opt) == 4)) { uint8_t dscp; - uint8_t class; - uint8_t prec; + uint8_t class = 0; + uint8_t prec = 0; /* There are four classes, AF1x, AF2x, AF3x, and AF4x. */ if (opt[2] == '1')