tarantool / checkpatch

Checkpatch for Tarantool
GNU General Public License v2.0
2 stars 2 forks source link

cpp direct initialization is confused with function definition #33

Closed sergepetrenko closed 2 years ago

sergepetrenko commented 2 years ago

Example output:

ERROR: function definition argument 'region' should also have an identifier name
#184: FILE: src/main.cc:165:
+   RegionGuard guard(region);

total: 1 errors, 215 lines checked
Commit b6b54af3b2c0 ("core: inline trigger_fiber_run into on_shutdown_f") has style problems, please review.

Code:


static int
on_shutdown_f(va_list ap)
{
    ...
    struct region *region = &fiber()->gc;
    RegionGuard guard(region);
CuriousGeorgiy commented 2 years ago

You can actually use unicorn initialization, i.e. RegionGuard guard{region};.