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

Conversation

Projects
None yet
2 participants
@ribbons
Copy link
Contributor

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.

ribbons added some commits Dec 30, 2013

Remove typedef specifier from URLPARAM_RESULT enum
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.
Re-order initializer list to match member order
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 extra brackets to while loop in printP
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.
Change some ints and chars to unsigned
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.
Hide warning when passing string to m_defaultCmd
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

Merge pull request #44 from ribbons/compiler-warnings
Fix compiler warnings generated when compiling with -Wall flag.

@unwiredben unwiredben merged commit 96ca7e6 into sirleech:master Dec 30, 2013

@ribbons ribbons deleted the ribbons:compiler-warnings branch Dec 31, 2013

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.