When receiving a response to a request send our earlier, it is in
some cases essential, to know something about who send the reponse.
This is needed for example when sending requests to multicast
addresses to be able to react to different incoming responses.
* net/gcoap: fixed request state when getting a resp
The request state should be set to GCOAP_MEMO_RESP before calling
the response handler in case we actually go a response...
* net/gcoap: make test for 0.00 code more efficient
This optimization saves the computation of the code and compares
the raw field to `0`.
Also changed semantics for storage of message ID, from last ID to next ID.
This change provides idiomatic use of the return value of the atomic
function, without other side effects on gcoap.
The packet buffer was originally designed to have a replaceable
back-end. This is why the actual module is called `gnrc_pktbuf_static`.
However, since than some auxiliary functions snuck into the static
back-end, which should go into the common module (which is a
pseudo-module at the moment).
This fix makes the `gnrc_pktbuf` pseudo-module an actual module and
moves the auxiliary functions to that module.
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/