From 9bcfe8fac05b2723242e50f5647d6a5990c7ccb0 Mon Sep 17 00:00:00 2001 From: Jason Dellaluce Date: Wed, 30 Aug 2023 16:31:39 +0000 Subject: [PATCH] fix(userspace/engine): support both old and new gcc + std::move 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 --- userspace/engine/falco_engine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/userspace/engine/falco_engine.cpp b/userspace/engine/falco_engine.cpp index 57622b1dda5..3b7969a9974 100644 --- a/userspace/engine/falco_engine.cpp +++ b/userspace/engine/falco_engine.cpp @@ -246,7 +246,13 @@ std::unique_ptr 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);