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

Fix two compiler warnings generated by updated toolchain #2190

Merged
merged 2 commits into from Jul 19, 2014

Conversation

2 participants
@ribbons
Copy link

commented Jul 17, 2014

Fix two compiler warnings generated when building with warnings enabled (after the recent toolchain update):

libraries\Ethernet\src\utility\socket.cpp: In function 'uint16_t igmpsend(SOCKET, const uint8_t*, uint16_t)':
libraries\Ethernet\src\utility\socket.cpp:322:11: warning: variable 'status' set but not used [-Wunused-but-set-variable]
   uint8_t status=0;
           ^
hardware\arduino\avr\cores\arduino\Stream.cpp: In member function 'bool Stream::find(char*)':
hardware\arduino\avr\cores\arduino\Stream.cpp:78:30: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   return findUntil(target, "");
                              ^

ribbons added some commits Jul 16, 2014

Remove unused variable from ethernet socket utils
Remove the variable 'status' as this had a value assigned (from readSnSR),
but it was never used.
Cast empty string to char* to fix compiler warning
Stream::find(char *target) passes an empty terminator string to
Stream::findUntil(char *target, char *terminator) which caused a compiler
warning with the updated toolchain, so cast it to a char*.
@@ -335,7 +334,6 @@ uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len)

while ( (W5100.readSnIR(s) & SnIR::SEND_OK) != SnIR::SEND_OK )
{
status = W5100.readSnSR(s);

This comment has been minimized.

Copy link
@cmaglie

cmaglie Jul 19, 2014

Member

This change may remove eventual side-effects of reading SnSR register, so to be 100% sure it should be changed from:

status = W5100.readSnSR(s);

to

W5100.readSnSR(s);

BTW looking at the datasheet it seems that the status register is read-only and reading (or not reading) it should be transparent for any subsequent operation.

cmaglie added a commit that referenced this pull request Jul 19, 2014

Merge pull request #2190 from ribbons/compiler-warnings
Fix two compiler warnings generated by updated toolchain

@cmaglie cmaglie merged commit dbd9b77 into arduino:ide-1.5.x Jul 19, 2014

@ribbons ribbons deleted the ribbons:compiler-warnings branch Jul 19, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.