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 2 commits into from Jul 19, 2014

Fix two compiler warnings generated by updated toolchain #2190

merged 2 commits into from Jul 19, 2014


Copy link

@ribbons ribbons 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, "");

Remove the variable 'status' as this had a value assigned (from readSnSR),
but it was never used.
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);
Copy link

Choose a reason for hiding this comment

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

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);



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
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 compiler-warnings branch July 19, 2014 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants