From f0dad18865720783e473db86081ab78e581c6f4d Mon Sep 17 00:00:00 2001 From: SaeHie Park Date: Mon, 28 Apr 2025 12:41:31 +0900 Subject: [PATCH] [luci/pass] Revise Pass to fix gcc-13 error This will revise luci::Pass to fix gcc-13 overloaded-virtual error. ONE-DCO-1.0-Signed-off-by: SaeHie Park --- compiler/luci/pass/include/luci/ModulePass.h | 14 +++++++++++++- compiler/luci/pass/src/VerifyQuantizedNodeType.h | 11 ++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/compiler/luci/pass/include/luci/ModulePass.h b/compiler/luci/pass/include/luci/ModulePass.h index 2b713ae47f5..3819d63a534 100644 --- a/compiler/luci/pass/include/luci/ModulePass.h +++ b/compiler/luci/pass/include/luci/ModulePass.h @@ -22,16 +22,28 @@ #include +#include + namespace luci { -class Pass : public logo::Pass +class ModulePass { public: // Run module pass and return false if there was nothing changed virtual bool run(luci::Module *) = 0; }; +class Pass : public logo::Pass, public ModulePass +{ +public: + // NOTE adding dummy run() to make compiler happy with "-Werror=overloaded-virtual=" + // clang-format off + bool run(loco::Graph *) override { throw std::runtime_error("Must inherit"); } + bool run(luci::Module *) override { throw std::runtime_error("Must inherit"); } + // clang-format on +}; + } // namespace luci #endif // __LUCI_PASS_MODULE_PASS_H__ diff --git a/compiler/luci/pass/src/VerifyQuantizedNodeType.h b/compiler/luci/pass/src/VerifyQuantizedNodeType.h index 15ec384413c..65a8c8b50bc 100644 --- a/compiler/luci/pass/src/VerifyQuantizedNodeType.h +++ b/compiler/luci/pass/src/VerifyQuantizedNodeType.h @@ -20,6 +20,8 @@ #include #include +#include + namespace luci { @@ -129,9 +131,12 @@ class VerifyQuantizedNodeTypeBase : public luci::CircleNodeVisitor, // NOTE below nodes has differnent implementation for Qtype/Btype and // implementations exist in VerifyQuantizedNodeU8Type, VerifyQuantizedNodeS16Type - // bool visit(const luci::CircleLogistic *node); - // bool visit(const luci::CircleSoftmax *node); - // bool visit(const luci::CircleTanh *node); + // NOTE adding dummy visit() to make compiler happy with "-Werror=overloaded-virtual=" + // clang-format off + bool visit(const luci::CircleLogistic *) { throw std::runtime_error("Must inherit"); } + bool visit(const luci::CircleSoftmax *) { throw std::runtime_error("Must inherit"); } + bool visit(const luci::CircleTanh *) { throw std::runtime_error("Must inherit"); } + // clang-format on // TODO: Implement more Ops