From b1ef1b502da11c03a4fbfb228abd017bd2aec613 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 16 Feb 2011 09:45:35 +0100 Subject: [PATCH] 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. --- src/oping.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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') -- 2.11.0