Skip to content

Commit

Permalink
fix(userspace/engine): support both old and new gcc + std::move
Browse files Browse the repository at this point in the history
Old gcc versions (e.g. 4.8.3) won't allow move elision
but newer versions (e.g. 10.2.1) would complain about
the redundant move.

Signed-off-by: Jason Dellaluce <[email protected]>
  • Loading branch information
jasondellaluce authored and poiana committed Aug 30, 2023
1 parent a6c2bf7 commit 01093d2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions userspace/engine/falco_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,13 @@ std::unique_ptr<load_result> falco_engine::load_rules_file(const std::string &ru

res->add_error(load_result::LOAD_ERR_FILE_READ, e.what(), ctx);

// Old gcc versions (e.g. 4.8.3) won't allow move elision but newer versions
// (e.g. 10.2.1) would complain about the redundant move.
#if __GNUC__ > 4
return res;
#else
return std::move(res);
#endif
}

return load_rules(rules_content, rules_filename);
Expand Down

0 comments on commit 01093d2

Please sign in to comment.