Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/driver_adt7310: Add explicit cast required for llvm #12345

Merged
merged 1 commit into from
Oct 1, 2019

Conversation

fhessel
Copy link
Contributor

@fhessel fhessel commented Sep 30, 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 in tests/driver_adt7310 (see Murdock's output).

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 -C tests/driver_adt7310 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

@benpicco benpicco added Area: tests Area: tests and testing framework Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Sep 30, 2019
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only changes a cast to avoid generating a warning.
No change in output.

Actually the output was buggy before and would always print xx.0000001 C

Now the output is correct.

@benpicco benpicco merged commit 846a4bc into RIOT-OS:master Oct 1, 2019
@fhessel fhessel deleted the adt7310_llvm branch October 1, 2019 05:04
@kb2ma kb2ma added this to the Release 2019.10 milestone Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants