From 2dd5e3bc2a2ce305553e3bcdaf82c8f87cb1ad93 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 21 Jan 2016 17:18:47 +0100 Subject: [PATCH] Close #69 Unused Var: Warning Close #69 [This](http://stackoverflow.com/a/3418951) stackoverflow post recommended [that](http://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/) Herb Sutter blog post with a general and portable solution and it works great! :) --- include/pybind11/attr.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/pybind11/attr.h b/include/pybind11/attr.h index 757b1cb3..6eb8ac86 100644 --- a/include/pybind11/attr.h +++ b/include/pybind11/attr.h @@ -250,24 +250,26 @@ template struct process_attribute void ignore_unused(const T&) { } /// Recursively iterate over variadic template arguments template struct process_attributes { static void init(const Args&... args, function_record *r) { int unused[] = { 0, (process_attribute::type>::init(args, r), 0) ... }; - (void) unused; (void) r; + ignore_unused(unused); } static void init(const Args&... args, type_record *r) { int unused[] = { 0, (process_attribute::type>::init(args, r), 0) ... }; - (void) unused; (void) r; + ignore_unused(unused); } static void precall(handle fn_args) { int unused[] = { 0, (process_attribute::type>::precall(fn_args), 0) ... }; - (void) unused; (void) fn_args; + ignore_unused(unused); } static void postcall(handle fn_args, handle fn_ret) { int unused[] = { 0, (process_attribute::type>::postcall(fn_args, fn_ret), 0) ... }; - (void) unused; (void) fn_args; (void) fn_ret; + ignore_unused(unused); } };