SPS30 Library Issue

When compiling any code with the sps30 library I get this error. The code being verified never had verifying issues before.

lib/SPS30/SPS30.cpp:56:1: no return statement in function returning non-void [-Werror=return-type]

What does this issue mean?

It means exactly what it says.
A function that promises to return a value does just end without ever returning the value.

Obviously the programmer “forgot” in at least one code path the required return statement.

This may have built in the past as the compiler was more lenient about this issue.
But, since such an error can cause unexpected behaviour (including SOS panic crashes) the rule to demand a return statement at compile time was enforced.

These functions are the culprits

They promise to return a void* but there is no return statement to be seen.

@Colleen, since the contributor of this library (@nesl.clemson) hasn’t provided a link to a GitHub repository to file issue reports, could you take care of having this library repaired?

1 Like

Thanks for bringing this to my attention @ScruffR - I’ll work on it.

1 Like

Have there been any updates on this issue. I assume that they used the following gitgub repository since there are not that many out there. Would it be possible to add it myself? I am still having issues with the sps30.h library.

I am one of the members that add this library for particle. In stead of returning a variable, these functions edit the proveded arrays and places the values in the array. Not sure why you are getting verify errors. I just compiled in the project we wrote this for and in a new test project and both came back successful.

That might be so, but when a function promises to return a value it has to do so too.
If you don’t want to return anything you should make it a void function (and not a void*).
But the return value doesn’t always have to be the same as the object of its action but a mere “status report” - as many functions do.

Which device OS version did you target for that test?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.