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

Missing break after line 12886 in switch/case #789

Closed
jamespharvey20 opened this issue Oct 17, 2017 · 3 comments
Closed

Missing break after line 12886 in switch/case #789

jamespharvey20 opened this issue Oct 17, 2017 · 3 comments
Labels
solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@jamespharvey20
Copy link

case lexer::token_type::parse_error:
{
   // using "uninitialized" to avoid "expected" message
   expect(lexer::token_type::uninitialized); // line 12886
}

On gcc 7.2.0, with -Werror, this causes:

json.hpp:12886:27: error: this statement may fall through [-Werror=implicit-fallthrough=]
                     expect(lexer::token_type::uninitialized);
                     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
json.hpp:12889:17: note: here
                 default:
                 ^~~~~~~
cc1plus: all warnings being treated as errors

This is of course worked around by including the json directory as a system directory.

And, it's sort of a non-issue because if expect() throws, it never falls through, and if it doesn't throw the first time, it won't throw the second time.

@nlohmann
Copy link
Owner

This should be fixed in the latest develop version. There, the code is

case token_type::parse_error:
{
    // using "uninitialized" to avoid "expected" message
    if (not expect(token_type::uninitialized))
    {
        return;
    }
    break; // LCOV_EXCL_LINE
}

@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Oct 18, 2017
@nlohmann
Copy link
Owner

@jamespharvey20 Could you please try the most recent develop version?

@jamespharvey20
Copy link
Author

@nlohmann, sorry, yes, develop fixes this issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants