posix: fix pthread and socket example#8368
Conversation
|
note: you need to use gcc 7.2 on master and this PR to verify the fix |
|
error messages, as follows: usleep: |
|
and |
126c088 to
fbb3476
Compare
jnohlgard
left a comment
There was a problem hiding this comment.
I am aware that usleep had been deprecated since before I started writing C (it was marked obsolete in 2001 according to the above link), but I am not convinced that this is the way we want to solve this. Do we provide a posix usleep function implementation? Do we need it for anything or is it just bloat? Do we provide a nanosleep function implementation that can be used instead?
At least for msp430-libc and avr-libc we do (the implementation is in |
(at least the Linux manpages do not mention that). |
|
first and foremost this RP is about getting things to work with GCC 7.x. I didn't want to start kind of a philosophical discussion or question POSIX compatibility and so on. |
POSIX stuff here, there are more fixes needed to actually compile all of RIOT with GCC 7.x |
Why not fix to use xtimer_usleep? |
|
this is about POSIX and portability (I would say), i.e., using standard headers without need for RIOT specific ones. Look at the examples, they don't see xtimer but just use standard header functions. Fixing this by using xtimer, renders this tests redundant. |
Maybe not redundant, but one wouldn't be able to run it on e.g. Linux anymore, which should be possible at the moment with this example. |
|
ping @gebart? |
|
ping, this bugfix could also go into the release (I'll provide a backport). It would be nice to have GCC 7 support, or not? |
|
Sorry for the delay |
Contribution description
Started with fixing an intentional fall through reported as error by newer GCC (>7.x) versions. But also found an issue with the usage of
usleep, apparently POSIX deprecated it and suggests to usenanosleepinstead? See here https://stackoverflow.com/questions/10053788/implicit-declaration-of-function-usleepIssues/PRs references
#8265