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 compiler warnings generated when compiling with -Wall flag. #44

Merged
merged 5 commits into from
Dec 30, 2013
Merged

Fix compiler warnings generated when compiling with -Wall flag. #44

merged 5 commits into from
Dec 30, 2013

Conversation

ribbons
Copy link
Contributor

@ribbons ribbons commented Dec 30, 2013

These commits resolve all of the warnings which were generated when compiling the current library with the -Wall flag passed to avr-gcc. One of them also has the nice side effect of shaving 42 bytes off the compiled program size when building for the Arduino Uno.

Remove the typedef storage class specifier from the declaration of the
URLPARAM_RESULT enum as this is not required and causes gcc to emit the
warning "'typedef' was ignored in this declaration" when compiling with
-Wall.
Correct the order of the initializer list so that gcc doesn't emit the
warning "'WebServer::m_cmdCount' will be initialized after 'int
WebServer::m_contentLength' when initialized here" when compiling using
-Wall.
Add an additional set of brackets around the while loop condition in
WebServer::printP to stop gcc emitting the warning "suggest parentheses
around assignment used as truth value" when compiling using -Wall.
Convert some of the int and char variables to be unsigned int and unsigned
char types.  This prevents gcc generating the warnings "comparison between
signed and unsigned integer expressions" and "array subscript has type
'char'", as well as having a nice side-effect of shaving 42 bytes off the
compiled size when building for the Uno.
The Command prototype has a char* parameter for the URL tail, but
WebServer::dispatchCommand calls this with an empty string as a parameter
if there is no URL.  As gcc treats empty strings as const char*s this
causes a warning to be emitted when compiling using -Wall, so suppress it
by explicitly casting it to char*.
unwiredben added a commit that referenced this pull request Dec 30, 2013
Fix compiler warnings generated when compiling with -Wall flag.
@unwiredben unwiredben merged commit 96ca7e6 into sirleech:master Dec 30, 2013
@ribbons ribbons deleted the compiler-warnings branch December 31, 2013 09:24
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

Successfully merging this pull request may close these issues.

2 participants