1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/net/gnrc
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 f tftp: address @aabadie comments. 2017-04-04 14:02:36 +02:00
link_layer net/gnrc/eth: enable filtering of L2 addresses 2017-05-18 15:24:25 +02:00
netapi gnrc_netreg: add arbitrary callback support 2016-10-25 21:35:57 +02:00
netif cppcheck: grnc/netif/hdr fix cppcheck warnings 2016-12-20 16:49:10 +01:00
netreg gnrc_tcp : initial implementation 2017-01-22 09:27:58 +01:00
nettest gnrc: use new netreg helper functions everywhere 2016-10-25 18:47:30 +02:00
network_layer ndp: warn gcc-7 about intentional fall-through 2017-05-30 14:23:37 +02:00
pkt gnrc: cleanup and corrections in gnrc_pkt 2017-04-22 20:56:54 +02:00
pktbuf_static gnrc_pktbuf: adapt pktbuf to od change 2017-03-28 19:14:59 +02:00
pktdump gnrc/pktdump: add tcp_hdr_print 2017-02-07 13:42:41 +01:00
priority_pktqueue gnrc_priority_queue: fix doxygen document. 2016-12-10 18:56:13 +01:00
routing/rpl cleanup: apply headerguard script output 2017-05-24 17:54:02 +02:00
sock gnrc: fix cppcheck warnings 2017-04-14 14:36:14 +02:00
transport_layer cleanup: apply headerguard script output 2017-05-24 17:54:02 +02:00
Makefile net: remove conn API 2017-04-28 15:23:54 +02:00