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

Warning - No break at the end of case #444

Closed
etiennebatise opened this issue Oct 13, 2015 · 4 comments
Closed

Warning - No break at the end of case #444

etiennebatise opened this issue Oct 13, 2015 · 4 comments

Comments

@etiennebatise
Copy link
Contributor

Hi,
I'm using rapidJSON on a C++ project with Eclipse CDT. So the IDE finds warnings in some switch case statements in the rapidJSON library. It seems breaks are missing in the default statements here :

document.h

reader.h

reader.h

reader.h

reader.h

Is it something that is going to be fixed ?

@thebusytypist
Copy link
Contributor

I think the break statement is not mandatory in switch-case clause. Which
compiler are you using?

On Tuesday, October 13, 2015, Etienne Batise notifications@github.com
wrote:

Hi,
I'm using rapidJSON on a C++ project with Eclipse CDT. So the IDE finds
warnings in some switch case statements in the rapidJSON library. It seems
breaks are missing in the default statements here :

document.h
https://github.com/miloyip/rapidjson/blob/master/include/rapidjson/document.h#L2101

reader.h
https://github.com/miloyip/rapidjson/blob/master/include/rapidjson/reader.h#L510

reader.h
https://github.com/miloyip/rapidjson/blob/master/include/rapidjson/reader.h#L546

reader.h
https://github.com/miloyip/rapidjson/blob/master/include/rapidjson/reader.h#L995

reader.h
https://github.com/miloyip/rapidjson/blob/master/include/rapidjson/reader.h#L1397

Is it something that is going to be fixed ?


Reply to this email directly or view it on GitHub
#444.

@mloskot
Copy link
Contributor

mloskot commented Oct 13, 2015

It falls into good pracitces to include break at every level of switch, even the last one (i.e. it makes code clear, refactoring friendly, etc.).
Perhaps @etiennebatise compiles in strict mode, with static analysis on.

@miloyip
Copy link
Collaborator

miloyip commented Oct 14, 2015

I am open to this. Please submit a PR.

@etiennebatise
Copy link
Contributor Author

@mloskot is right, I use -Wall with g++.
I'll submit a PR as soon as possible about this.

etiennebatise added a commit to etiennebatise/rapidjson that referenced this issue Oct 14, 2015
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

No branches or pull requests

4 participants