@@ -64,9 +64,8 @@ void table_global_string_get_measure(benchmark::State& state)
6464 luabridge::setGlobal (L, kMagicValue , " value" );
6565
6666 double x = 0 ;
67- for (auto _ : state)
67+ for ([[maybe_unused]] auto _ : state)
6868 {
69- (void ) _;
7069 x += static_cast <double >(luabridge::getGlobal (L, " value" ));
7170 }
7271
@@ -78,9 +77,8 @@ void table_global_string_set_measure(benchmark::State& state)
7877 lua_State* L = makeLua ();
7978
8079 double v = 0 ;
81- for (auto _ : state)
80+ for ([[maybe_unused]] auto _ : state)
8281 {
83- (void ) _;
8482 v += kMagicValue ;
8583 luabridge::setGlobal (L, v, " value" );
8684 }
@@ -95,9 +93,8 @@ void table_get_measure(benchmark::State& state)
9593 luabridge::LuaRef t = luabridge::getGlobal (L, " warble" );
9694
9795 double x = 0 ;
98- for (auto _ : state)
96+ for ([[maybe_unused]] auto _ : state)
9997 {
100- (void ) _;
10198 x += static_cast <double >(t[" value" ]);
10299 }
103100
@@ -111,9 +108,8 @@ void table_set_measure(benchmark::State& state)
111108 luabridge::LuaRef t = luabridge::getGlobal (L, " warble" );
112109
113110 double v = 0 ;
114- for (auto _ : state)
111+ for ([[maybe_unused]] auto _ : state)
115112 {
116- (void ) _;
117113 v += kMagicValue ;
118114 t[" value" ] = v;
119115 }
@@ -127,9 +123,8 @@ void table_chained_get_measure(benchmark::State& state)
127123 luaDoStringOrThrow (L, " ulahibe = { warble = { value = 24.0 } }" , " vanilla chained_get setup" );
128124
129125 double x = 0 ;
130- for (auto _ : state)
126+ for ([[maybe_unused]] auto _ : state)
131127 {
132- (void ) _;
133128 luabridge::LuaRef tw = luabridge::getGlobal (L, " ulahibe" )[" warble" ];
134129 x += static_cast <double >(tw[" value" ]);
135130 }
@@ -143,9 +138,8 @@ void table_chained_set_measure(benchmark::State& state)
143138 luaDoStringOrThrow (L, " ulahibe = { warble = { value = 24.0 } }" , " vanilla chained_set setup" );
144139
145140 double v = 0 ;
146- for (auto _ : state)
141+ for ([[maybe_unused]] auto _ : state)
147142 {
148- (void ) _;
149143 v += kMagicValue ;
150144 luabridge::LuaRef tw = luabridge::getGlobal (L, " ulahibe" )[" warble" ];
151145 tw[" value" ] = v;
@@ -160,9 +154,8 @@ void c_function_measure(benchmark::State& state)
160154 luabridge::getGlobalNamespace (L).addFunction (" f" , +[](double v) { return v; });
161155 luaDoStringOrThrow (L, " function invoke_f() return f(24.0) end" , " vanilla c_function setup" );
162156
163- for (auto _ : state)
157+ for ([[maybe_unused]] auto _ : state)
164158 {
165- (void ) _;
166159 lua_getglobal (L, " invoke_f" );
167160 luaCheckOrThrow (L, lua_pcall (L, 0 , 1 , 0 ), " vanilla invoke_f" );
168161 lua_pop (L, 1 );
@@ -176,9 +169,8 @@ void lua_function_in_c_measure(benchmark::State& state)
176169
177170 luabridge::LuaRef f = luabridge::getGlobal (L, " f" );
178171 double x = 0 ;
179- for (auto _ : state)
172+ for ([[maybe_unused]] auto _ : state)
180173 {
181- (void ) _;
182174 x += static_cast <double >(f (kMagicValue ));
183175 }
184176
@@ -192,9 +184,8 @@ void c_function_through_lua_in_c_measure(benchmark::State& state)
192184
193185 luabridge::LuaRef f = luabridge::getGlobal (L, " f" );
194186 double x = 0 ;
195- for (auto _ : state)
187+ for ([[maybe_unused]] auto _ : state)
196188 {
197- (void ) _;
198189 x += static_cast <double >(f (kMagicValue ));
199190 }
200191
@@ -208,9 +199,8 @@ void member_function_call_measure(benchmark::State& state)
208199 luaDoStringOrThrow (L, " b = c()" , " vanilla member setup" );
209200 luaDoStringOrThrow (L, " function call_member() b:set(b:get() + 1.0) end" , " vanilla member closure setup" );
210201
211- for (auto _ : state)
202+ for ([[maybe_unused]] auto _ : state)
212203 {
213- (void ) _;
214204 lua_getglobal (L, " call_member" );
215205 luaCheckOrThrow (L, lua_pcall (L, 0 , 0 , 0 ), " vanilla call_member" );
216206 }
@@ -223,9 +213,8 @@ void userdata_variable_access_measure(benchmark::State& state)
223213 luaDoStringOrThrow (L, " b = c()" , " vanilla userdata setup" );
224214 luaDoStringOrThrow (L, " function access_var() b.var = b.var + 1.0 return b.var end" , " vanilla userdata closure setup" );
225215
226- for (auto _ : state)
216+ for ([[maybe_unused]] auto _ : state)
227217 {
228- (void ) _;
229218 lua_getglobal (L, " access_var" );
230219 luaCheckOrThrow (L, lua_pcall (L, 0 , 1 , 0 ), " vanilla access_var" );
231220 lua_pop (L, 1 );
@@ -253,9 +242,8 @@ void multi_return_lua_measure(benchmark::State& state)
253242 luabridge::getGlobalNamespace (L).addCFunction (" f" , vanilla_multi_return);
254243 luaDoStringOrThrow (L, " function invoke_multi() local a,b=f(24.0) return a+b end" , " vanilla multi_return_lua setup" );
255244
256- for (auto _ : state)
245+ for ([[maybe_unused]] auto _ : state)
257246 {
258- (void ) _;
259247 lua_getglobal (L, " invoke_multi" );
260248 luaCheckOrThrow (L, lua_pcall (L, 0 , 1 , 0 ), " vanilla invoke_multi" );
261249 lua_pop (L, 1 );
@@ -281,9 +269,8 @@ void return_userdata_measure(benchmark::State& state)
281269 .addFunction (" h" , &basic_get_var);
282270 luaDoStringOrThrow (L, " function invoke_userdata() return h(f()) end" , " vanilla return_userdata setup" );
283271
284- for (auto _ : state)
272+ for ([[maybe_unused]] auto _ : state)
285273 {
286- (void ) _;
287274 lua_getglobal (L, " invoke_userdata" );
288275 luaCheckOrThrow (L, lua_pcall (L, 0 , 1 , 0 ), " vanilla invoke_userdata" );
289276 lua_pop (L, 1 );
@@ -296,9 +283,8 @@ void optional_success_measure(benchmark::State& state)
296283 luaDoStringOrThrow (L, " warble = { value = 24.0 }" , " vanilla optional_success setup" );
297284
298285 double x = 0 ;
299- for (auto _ : state)
286+ for ([[maybe_unused]] auto _ : state)
300287 {
301- (void ) _;
302288 luabridge::LuaRef tt = luabridge::getGlobal (L, " warble" );
303289 if (tt.isTable ())
304290 {
@@ -320,9 +306,8 @@ void optional_half_failure_measure(benchmark::State& state)
320306 luaDoStringOrThrow (L, " warble = { value = 'x' }" , " vanilla optional_half_failure setup" );
321307
322308 double x = 0 ;
323- for (auto _ : state)
309+ for ([[maybe_unused]] auto _ : state)
324310 {
325- (void ) _;
326311 luabridge::LuaRef tt = luabridge::getGlobal (L, " warble" );
327312 if (tt.isTable ())
328313 {
@@ -343,9 +328,8 @@ void optional_failure_measure(benchmark::State& state)
343328 lua_State* L = makeLua ();
344329
345330 double x = 0 ;
346- for (auto _ : state)
331+ for ([[maybe_unused]] auto _ : state)
347332 {
348- (void ) _;
349333 luabridge::LuaRef tt = luabridge::getGlobal (L, " warble" );
350334 if (tt.isTable ())
351335 {
@@ -368,9 +352,8 @@ void userdata_variable_write_measure(benchmark::State& state)
368352 luaDoStringOrThrow (L, " b = c()" , " vanilla userdata_write setup" );
369353 luaDoStringOrThrow (L, " function write_var() b.var = 24.0 end" , " vanilla userdata_write closure setup" );
370354
371- for (auto _ : state)
355+ for ([[maybe_unused]] auto _ : state)
372356 {
373- (void ) _;
374357 lua_getglobal (L, " write_var" );
375358 luaCheckOrThrow (L, lua_pcall (L, 0 , 0 , 0 ), " vanilla write_var" );
376359 }
@@ -383,9 +366,8 @@ void userdata_property_getter_measure(benchmark::State& state)
383366 luaDoStringOrThrow (L, " b = c()" , " vanilla property_getter setup" );
384367 luaDoStringOrThrow (L, " function read_getter() return b.val end" , " vanilla property_getter closure setup" );
385368
386- for (auto _ : state)
369+ for ([[maybe_unused]] auto _ : state)
387370 {
388- (void ) _;
389371 lua_getglobal (L, " read_getter" );
390372 luaCheckOrThrow (L, lua_pcall (L, 0 , 1 , 0 ), " vanilla read_getter" );
391373 lua_pop (L, 1 );
@@ -399,9 +381,8 @@ void userdata_property_setter_measure(benchmark::State& state)
399381 luaDoStringOrThrow (L, " b = c()" , " vanilla property_setter setup" );
400382 luaDoStringOrThrow (L, " function write_setter() b.val = 24.0 end" , " vanilla property_setter closure setup" );
401383
402- for (auto _ : state)
384+ for ([[maybe_unused]] auto _ : state)
403385 {
404- (void ) _;
405386 lua_getglobal (L, " write_setter" );
406387 luaCheckOrThrow (L, lua_pcall (L, 0 , 0 , 0 ), " vanilla write_setter" );
407388 }
@@ -414,9 +395,8 @@ void lambda_capture_measure(benchmark::State& state)
414395 luabridge::getGlobalNamespace (L).addFunction (" f" , std::function<double (double )>([extra](double v) { return v + extra; }));
415396 luaDoStringOrThrow (L, " function invoke_lambda() return f(24.0) end" , " vanilla lambda_capture setup" );
416397
417- for (auto _ : state)
398+ for ([[maybe_unused]] auto _ : state)
418399 {
419- (void ) _;
420400 lua_getglobal (L, " invoke_lambda" );
421401 luaCheckOrThrow (L, lua_pcall (L, 0 , 1 , 0 ), " vanilla invoke_lambda" );
422402 lua_pop (L, 1 );
@@ -439,9 +419,8 @@ void static_member_function_call_measure(benchmark::State& state)
439419 registerCounter (L);
440420 luaDoStringOrThrow (L, " function invoke_static() return Counter.static_add(10, 32) end" , " vanilla static_member_function setup" );
441421
442- for (auto _ : state)
422+ for ([[maybe_unused]] auto _ : state)
443423 {
444- (void ) _;
445424 lua_getglobal (L, " invoke_static" );
446425 luaCheckOrThrow (L, lua_pcall (L, 0 , 1 , 0 ), " vanilla invoke_static" );
447426 lua_pop (L, 1 );
@@ -466,9 +445,8 @@ void derived_method_call_measure(benchmark::State& state)
466445 luaDoStringOrThrow (L, " obj = ComplexAB()" , " vanilla derived_method setup" );
467446 luaDoStringOrThrow (L, " function call_derived() return obj:ab_func() end" , " vanilla derived_method closure setup" );
468447
469- for (auto _ : state)
448+ for ([[maybe_unused]] auto _ : state)
470449 {
471- (void ) _;
472450 lua_getglobal (L, " call_derived" );
473451 luaCheckOrThrow (L, lua_pcall (L, 0 , 1 , 0 ), " vanilla call_derived" );
474452 lua_pop (L, 1 );
0 commit comments