Skip to content

Commit

Permalink
Work around a parameter-unused-but-set warning in gin/
Browse files Browse the repository at this point in the history
GCC thinks that the create_flags parameter in the templated class
gin::Invoker constructor is going unused, even though it is definitely
being used as a part of a variadic template expansion. Convince GCC
that it is in fact being used by casting it to a void.

BUG=424334
TEST=Linux GN build of gin with is_clang=false
R=aa

Review URL: https://codereview.chromium.org/694063002

Cr-Commit-Position: refs/heads/master@{#302361}
  • Loading branch information
cmasone authored and Commit bot committed Nov 1, 2014
1 parent 31783d4 commit a34136a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gin/function_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ class Invoker<IndicesHolder<indices...>, ArgTypes...>
// so it is guaranteed ArgumentHolders will be initialized (and thus, will
// extract arguments from Arguments) in the right order.
Invoker(Arguments* args, int create_flags)
: ArgumentHolder<indices, ArgTypes>(args, create_flags)...,
args_(args) {}
: ArgumentHolder<indices, ArgTypes>(args, create_flags)..., args_(args) {
// GCC thinks that create_flags is going unused, even though the
// expansion above clearly makes use of it. Per jyasskin@, casting
// to void is the commonly accepted way to convince the compiler
// that you're actually using a parameter/varible.
(void)create_flags;
}

bool IsOK() {
return And(ArgumentHolder<indices, ArgTypes>::ok...);
Expand Down

0 comments on commit a34136a

Please sign in to comment.