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

webserver.cpp:610:51: error: 'sid' may be used uninitialized in this function #62

Open
dopry opened this issue Sep 1, 2017 · 4 comments

Comments

@dopry
Copy link

dopry commented Sep 1, 2017

When creating a release build, this error warning kills the build. I can tell that sid gets assigned on line 563, but the compiler isn't bright enough to see that the two if conditions are mutually inclusive.

Here is the full make output.

g++ -c -Wall -Wno-unknown-pragmas -Werror -Wno-format -O3 -DNDEBUG -I /usr/include/openzwave/ -I /usr/include/openzwave/command_classes/ -I /usr/include/openzwave/value_classes/ -I /usr/include/openzwave/platform/ -I /usr/include/openzwave/platform/unix -I /usr/include/openzwave/cpp/tinyxml/ -I /usr/include/ -o ozwcp.o ozwcp.cpp
g++ -c -Wall -Wno-unknown-pragmas -Werror -Wno-format -O3 -DNDEBUG -I /usr/include/openzwave/ -I /usr/include/openzwave/command_classes/ -I /usr/include/openzwave/value_classes/ -I /usr/include/openzwave/platform/ -I /usr/include/openzwave/platform/unix -I /usr/include/openzwave/cpp/tinyxml/ -I /usr/include/ -o webserver.o webserver.cpp
webserver.cpp: In member function 'const char* Webserver::SendSceneResponse(MHD_Connection*, const char*, const char*, const char*, const char*)':
webserver.cpp:610:51: error: 'sid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   cnt = Manager::Get()->SceneGetValues(sid, &vids);
                                                   ^
cc1plus: all warnings being treated as errors
make: *** [Makefile:40: webserver.o] Error 1

The simple solution seems to be to init the scene id (sid) as either 0 or atoi((char *)arg1) on line 543.

dopry added a commit to dopry/open-zwave-control-panel that referenced this issue Sep 1, 2017
This whole section looks like it is being removed in Dev, bit this should fix
OpenZWave#62 in the mean time.
@daradib
Copy link

daradib commented Sep 8, 2017

@dopry yes I had the same compiler warning when Debian packaging. Do you want to try a PR to master?

@Fishwaldo
Copy link
Member

The scene stuff is being depreciated in the OZW Dev branch and ultimately OZWCP. Just FYI

@dopry
Copy link
Author

dopry commented Sep 8, 2017 via email

@daradib
Copy link

daradib commented Sep 9, 2017

@Fishwaldo thanks for the heads up! Do you plan to merge dev into master at some point? I have been maintaining the Debian package based on master because there are no releases (#51) - let me know if I should consider switching to dev or waiting for a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants