johnnyb / Shifty

Simple and flexible shift register manager for Arduino
MIT License
47 stars 11 forks source link

Warning in readBit #2

Closed venelinpetrov closed 7 years ago

venelinpetrov commented 7 years ago

Trying to compile an Arduino project and get the following warning:

Shifty.cpp: In member function 'bool Shifty::readBit(int)':
Shifty.cpp:62:1: warning: no return statement in function returning non-void [-Wreturn-type]
Shifty.cpp: In member function 'bool Shifty::readBitHard(int)':
Shifty.cpp:134:1: warning: no return statement in function returning non-void [-Wreturn-type]
Shifty.cpp: In member function 'bool Shifty::readBitHard(int)':
Shifty.cpp:134:1: warning: no return statement in function returning non-void [-Wreturn-type]

I wouldn't mind if the readBit function didn't always return 0. I don't know how this even compiles, though I don't have even a basic knowledge of C++, in C this wouldn't work at all.

johnnyb commented 7 years ago

Should be fixed. You should be able to download version 0.1.1 in an hour or so. I usually code in Ruby, so I often forget return statements.

venelinpetrov commented 7 years ago

Only one question, I'm using platformio to manage libraries. When I try to update the CLI returns Updating Shifty @ 0.1.0: [Up-to-date]. Any clue?

johnnyb commented 7 years ago

Try it now and let me know if it works. I forgot to update the versioning info in library.properties. There should be a 0.1.3 release available.

venelinpetrov commented 7 years ago

This time I get compilation error:

.piolibdeps\Shifty_ID801\src\Shifty.cpp:68:46: error: no 'void Shifty::setBitMode(int, bool)' member function declared in class 'Shifty'
void Shifty::setBitMode(int bitnum, bool mode) {
^
.piolibdeps\Shifty_ID801\src\Shifty.cpp: In member function 'bool Shifty::getBitMode(int)':
.piolibdeps\Shifty_ID801\src\Shifty.cpp:79:8: warning: unused variable 'b' [-Wunused-variable]
byte b = this->dataModes[bytenum]; //set b to working byte
^
.piolibdeps\Shifty_ID801\src\Shifty.cpp: In member function 'void Shifty::readAllBits()':
.piolibdeps\Shifty_ID801\src\Shifty.cpp:148:10: warning: unused variable 'outb' [-Wunused-variable]
byte outb = this->writeBuffer[i];
^
.piolibdeps\Shifty_ID801\src\Shifty.cpp:149:10: warning: unused variable 'inb' [-Wunused-variable]
byte inb = 0;
^
*** [.pioenvs\teensy20\lib\Shifty_ID801\Shifty.o] Error 1