[commits] [batctl] master: batctl: suppress implicit-fallthrough compiler warning (50ee3c4)

postmaster at open-mesh.org postmaster at open-mesh.org
Tue Jun 13 13:44:24 CEST 2017

Repository : ssh://git@open-mesh.org/batctl

On branch  : master


commit 50ee3c45feeda6d8c04ee127097badf99f78a26e
Author: Philipp Psurek <philipp.psurek at gmail.com>
Date:   Tue Jun 13 13:08:24 2017 +0200

    batctl: suppress implicit-fallthrough compiler warning
    GCC 7.1.0 complains about an intended fallthrough.
    “__attribute__ ((fallthrough))” in this part of code would suppress this
    warning. Because older GCC compiler don’t understand this statement attribute
    and because there is already a comment in the source containing
    “falls?[ \t-]*thr(ough|u)” we can suppress the warning with the
    “-Wimplicit-fallthrough=2” warning option. Unintended fallthroughs without a
    comment would trigger this warning again.
    To avoid compiler recognition in the Makefile a simply change of the comment
    is sufficient to suppress the warning. For some reason only stand alone
    comments mentioned in [1] are recognized so the comment has to be split up into
    two parts.
    [1] https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Warning-Options.html#index-Wimplicit-fallthrough_003d
    Signed-off-by: Philipp Psurek <philipp.psurek at gmail.com>
    [sw: Put the second comment part into a new line to avoid clutter]
    Signed-off-by: Simon Wunderlich <sw at simonwunderlich.de>


 tp_meter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tp_meter.c b/tp_meter.c
index 918fb79..a623a68 100644
--- a/tp_meter.c
+++ b/tp_meter.c
@@ -500,8 +500,9 @@ int tp_meter(char *mesh_iface, int argc, char **argv)
 		printf("CANCEL received: test aborted\n");
-		/* fall through and print the partial result */
+		/* fall through */
+		/* print the partial result */
 		if (result.test_time > 0) {
 			throughput = result.total_bytes * 1000;
 			throughput /= result.test_time;

More information about the commits mailing list