-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Increase compiler warning levels and associated code changes #1
Conversation
Hi, Ben, and thank you for the first pull request. It's good to see the library getting usage :) I'm strongly in favor of what you have done. I had actually forgotten that there are many flags not included in At the moment, I have a messy topic branch that is considerably different from Thanks again! |
If you're happy with the changes, I'd suggest to merge this PR into the current master so other users can obtain a more warning level friendly |
Thanks. Let me give them a proper review, especially the I am indeed now planning to more meticulously enable warning flags for each compiler in my topic branch. |
@@ -217,6 +217,7 @@ struct optional { | |||
|
|||
namespace _enum { | |||
|
|||
#pragma GCC diagnostic ignored "-Weffc++" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is caused by a mistake on my part. operator =
should be "normal", i.e. have return type const _eat_assign&
and return *this
.
If you don't mind, I will merge the edits you made to silence the warnings into |
8f79edf
to
d45405e
Compare
@aantron, thanks. I have made the changes you requested (ie removed |
@benalexau, thanks – it looks good. The only request I have is that you change the commit message, since this now doesn't add any flags, just makes sure the code will compile if people do add them. |
These modifications ensure enum.h can be used in a wider selection of end user projects without triggering warnings. GCC 4.9.2 was used with the following warning flags set: -Wall -Wextra -Wshadow -Weffc++ -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-long-long -Wstrict-aliasing -Werror -pedantic -std=c++1y -Wformat=2 -Wmissing-include-dirs -Wsync-nand -Wuninitialized -Wconditionally-supported -Wconversion -Wuseless-cast -Wzero-as-null-pointer-constant This commit includes the modifications required to enable successful use of enum.h via both the "test" and "example" directories.
Commit message modified. |
Modifications to support aggressive compiler warning levels.
Thank you :) |
Congratulations on your first pull request cycle. I hope there will be many more! :-) |
@benalexau thanks for helping me with it :) I have one last question – I tried the web merging UI despite reservations and now I have your commit coming off |
Normally the "merge" message gets its own commit. I personally agree it looks ugly. You also get these a lot with even git pull if you don't use --rebase. I see you have done a push -f already to fix it up, though. :-) |
Yeah, I'm going to shoot for having a "clean" history for as long as possible :) Thanks for all your help. Have a good whatever time of day it is, guessing morning :) |
Thanks for Better Enums. It's incredibly useful.
Some projects wishing to include
enum.h
might be following the advice of enabling all available compiler warning flags (eg C++ Coding Standards by Herb Sutter and Andrei Alexandrescu, Item #1, "Compile cleanly at high warning levels"). Such projects currently need to either modifyenum.h
or use#pragm
directives to disable warnings for that file.This PR modifies the example and test
Makefile
to enable all available warning flags, along with associated code changes to comply with the resulting compiler warnings. This allowsenum.h
to be directly used in projects without editing or#pragma
directives. The test cases pass and the examples execute without error.