Merge pull request #443 from ecsv/batadv-17.01
[feed/routing.git] / batctl / patches / 0002-batctl-suppress-implicit-fallthrough-compiler-warnin.patch
1 From: Philipp Psurek <philipp.psurek@gmail.com>
2 Date: Tue, 13 Jun 2017 13:08:24 +0200
3 Subject: [PATCH] batctl: suppress implicit-fallthrough compiler warning
4
5 GCC 7.1.0 complains about an intended fallthrough.
6 “__attribute__ ((fallthrough))” in this part of code would suppress this
7 warning. Because older GCC compiler don’t understand this statement attribute
8 and because there is already a comment in the source containing
9 “falls?[ \t-]*thr(ough|u)” we can suppress the warning with the
10 “-Wimplicit-fallthrough=2” warning option. Unintended fallthroughs without a
11 comment would trigger this warning again.
12
13 To avoid compiler recognition in the Makefile a simply change of the comment
14 is sufficient to suppress the warning. For some reason only stand alone
15 comments mentioned in [1] are recognized so the comment has to be split up into
16 two parts.
17
18 [1] https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Warning-Options.html#index-Wimplicit-fallthrough_003d
19
20 Signed-off-by: Philipp Psurek <philipp.psurek@gmail.com>
21 [sw: Put the second comment part into a new line to avoid clutter]
22 Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
23
24 Origin: upstream, https://git.open-mesh.org/batctl.git/commit/50ee3c45feeda6d8c04ee127097badf99f78a26e
25 ---
26 tp_meter.c | 3 ++-
27 1 file changed, 2 insertions(+), 1 deletion(-)
28
29 diff --git a/tp_meter.c b/tp_meter.c
30 index f95b8391ff3426200697034f1087274ca9e5a9dd..ec0dc4802c638471ff3c38bd344e31c208b634a5 100644
31 --- a/tp_meter.c
32 +++ b/tp_meter.c
33 @@ -498,8 +498,9 @@ int tp_meter(char *mesh_iface, int argc, char **argv)
34 break;
35 case BATADV_TP_REASON_CANCEL:
36 printf("CANCEL received: test aborted\n");
37 - /* fall through and print the partial result */
38 + /* fall through */
39 case BATADV_TP_REASON_COMPLETE:
40 + /* print the partial result */
41 if (result.test_time > 0) {
42 throughput = result.total_bytes * 1000;
43 throughput /= result.test_time;