1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00
RIOT/sys/net
Cenk Gündoğan 6065be76e1 ndp: warn gcc-7 about intentional fall-through
Since gcc-7 `Wimplicit-fallthrough` is activated by using `-Wextra`.
This leads to the following problem when compiling `gnrc_networking`:

```
RIOT/sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c: In function ‘gnrc_ndp_internal_set_state’:
RIOT/sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c:106:15: error: this statement may fall through [-Werror=implicit-fallthrough=]
   t = ipv6_iface->reach_time;
  ~~^~~~~~~~~~~~~~~~~~~~~~~~
RIOT/sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c:109:9: note: here
case GNRC_IPV6_NC_STATE_DELAY:
         ^~~~
```

The fall-through in this code is intentional. There are several ways to
warn the comiler about such intentional fall-throughs, which include
e.g. attributed empty statements (`__attribute__ ((fallthrough));`).
I don't like tis approach however. The best way would probably be to
remove this fall-through from the code. However, to keep the diff
minimal, and since ndp will change in the future, I went for warning
the compiler using comments.

The compiler checks comments for several *fall through* regexs to
decide whether a fallthrough was intentional or not.

You can read more about this gcc option in [1]. A note about
fallthrough comment regexs is at the bottom of this article.

[1] https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
2017-05-30 14:23:37 +02:00
..
application_layer net/gcoap: make input parameters const 2017-05-26 16:34:40 +02:00
crosslayer net: added L2FILTER option to netopt 2017-05-18 15:24:25 +02:00
gnrc ndp: warn gcc-7 about intentional fall-through 2017-05-30 14:23:37 +02:00
link_layer net: added link layer address filter module 2017-05-18 15:24:25 +02:00
netdev_test netdev2: rename to netdev and remove gnrc_netdev 2017-03-15 09:31:20 +01:00
network_layer ipv6_addr: provide fix for off-by-x error 2017-04-25 19:19:43 +02:00
routing nhdp: port to sock 2017-04-26 14:41:45 +02:00
sock sys: net: sock: add utility functions 2017-03-28 19:16:27 +02:00
transport_layer net: add tcp_hdr_print 2017-02-07 13:42:41 +01:00
doc.txt doc: add net to sys group 2015-08-30 14:00:33 +02:00