[riot-notifications] [RIOT-OS/RIOT] tests/driver_adt7310: Add explicit cast required for llvm (#12345)

Frank Hessel notifications at github.com
Mon Sep 30 23:01:09 CEST 2019

### Contribution description

This PR is related to PR #11352, where I suggest to add support for Linux' `/dev/spidev` devices to the native cpu. Enabling SPI causes the `tests/driver_adt7310` test to be run with the llvm toolchain for the first time.

llvm doesn't allow [the implicit cast to `int`](https://github.com/RIOT-OS/RIOT/blob/master/tests/driver_adt7310/main.c#L83) in tests/driver_adt7310 (see [Murdock's output](https://ci.riot-os.org/RIOT-OS/RIOT/11352/a9b48f793548f05c811fae3961e9756215c015d9/output.html#error0)).

This PR fixes this by using an explicit cast. Furthermore, `abs()` is replaced with `labs()`, as the parameter may take values which exceed a 16 bit `int` and could cause undefined behavior.

### Testing procedure

Run `BOARD=native TOOLCHAIN=llvm make all` without and with this PR and verify that the warning disappears. The build will still fail though, as native misses the required SPI support introduced in #11352.

### Issues/PRs references

Required for PR #11352 

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * tests/driver_adt7310: Add explicit cast required for llvm

-- File Changes --

    M tests/driver_adt7310/main.c (4)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190930/e8f420d0/attachment.htm>

More information about the notifications mailing list