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

Clarify loop logic to satisfy a Clang warning #113

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Clarify loop logic to satisfy a Clang warning
Clang warns that a for loop in a sample increments an iterator in both
the header and the body. This seems to be done on purpose to skip
whitespace. I used std::advance in the header instead, for clarity.

Also cleaned up an unused type in the same file while I was there.
  • Loading branch information
jefftrull committed Sep 25, 2020
commit 06c2ca14bf8ce4a0ae8274154144ffa94001dde5
5 changes: 2 additions & 3 deletions samples/preprocess_pragma_output/preprocess_pragma_output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class preprocess_pragma_output_hooks
typename Context::token_type const& option,
Container const& values, typename Context::token_type const& act_token)
{
typedef typename Context::token_type token_type;
typedef typename Context::iterator_type iterator_type;

if (option.get_value() == "pp") {
Expand All @@ -140,10 +139,10 @@ class preprocess_pragma_output_hooks
Container pragma;
iterator_type end = ctx.end();
for (iterator_type it = ctx.begin(s.begin(), s.end());
it != end && token_id(*it) != T_EOF; ++it)
it != end && token_id(*it) != T_EOF;
std::advance(it, 2)) // skip over whitespace
{
pragma.push_back(*it);
it++;
}

// prepend the newly generated token sequence to the 'pending'
Expand Down