From f5ac52888889a426fd51f0cce3aa8680dbeb9157 Mon Sep 17 00:00:00 2001 From: qiuyu Date: Thu, 30 Jun 2022 15:15:09 +0800 Subject: [PATCH] Fix build warnings lack of namespace and unused parameters Fix build warnings introduced by previous commit "Store type info as pairs of instruction orders and types" 1. Fix lack of namespace 2. Fix unused parameters Signed-off-by: qiuyu Change-Id: I944cc28adff056b90ed1f5b62b5c2f8a023d9553 --- .../ts2abc/tests/type_adapter_test/type_adapter_test.cpp | 7 +++++-- ts2panda/ts2abc/ts2abc.cpp | 1 + ts2panda/ts2abc/type_adapter.cpp | 2 ++ ts2panda/ts2abc/type_adapter.h | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ts2panda/ts2abc/tests/type_adapter_test/type_adapter_test.cpp b/ts2panda/ts2abc/tests/type_adapter_test/type_adapter_test.cpp index 74fa91fa82..4e8bf2f9a2 100644 --- a/ts2panda/ts2abc/tests/type_adapter_test/type_adapter_test.cpp +++ b/ts2panda/ts2abc/tests/type_adapter_test/type_adapter_test.cpp @@ -17,6 +17,7 @@ #include "assembler/meta.h" #include "assembler/assembly-parser.h" +namespace ts2abc_type_adapter::type_adapter_test { using ArrayValue = panda::pandasm::ArrayValue; using ScalarValue = panda::pandasm::ScalarValue; using AnnotationData = panda::pandasm::AnnotationData; @@ -132,12 +133,14 @@ void TypeAdapterTest::TestVariablesArgsType() const const int32_t instruction_location = 8; CheckTypeExist(typeinfo, instruction_location, 1); } +} // namespace ts2abc_type_adapter::type_adapter_test -int main(int argc, const char *argv[]) +int main() { - TypeAdapterTest test; + ts2abc_type_adapter::type_adapter_test::TypeAdapterTest test; std::cout << "TypeAdapterTest TestVariablesArgsType: " << std::endl; test.TestVariablesArgsType(); std::cout << "PASS!" << std::endl; + return 0; // should enable TestBuiltinsType when builtins adaption is ready } diff --git a/ts2panda/ts2abc/ts2abc.cpp b/ts2panda/ts2abc/ts2abc.cpp index 802ac449b8..75407dedb1 100644 --- a/ts2panda/ts2abc/ts2abc.cpp +++ b/ts2panda/ts2abc/ts2abc.cpp @@ -44,6 +44,7 @@ namespace { bool g_displayTypeinfo = false; std::string g_optLogLevel = "error"; uint32_t g_literalArrayCount = 0; + using ts2abc_type_adapter::TypeAdapter; constexpr std::size_t BOUND_LEFT = 0; constexpr std::size_t BOUND_RIGHT = 0; diff --git a/ts2panda/ts2abc/type_adapter.cpp b/ts2panda/ts2abc/type_adapter.cpp index 8c383f175d..1ab1e303fc 100644 --- a/ts2panda/ts2abc/type_adapter.cpp +++ b/ts2panda/ts2abc/type_adapter.cpp @@ -16,6 +16,7 @@ #include "type_adapter.h" #include "assembler/meta.h" +namespace ts2abc_type_adapter { void TypeAdapter::AdaptTypeForProgram(panda::pandasm::Program *prog) const { for (auto &[name, func] : prog->function_table) { @@ -151,3 +152,4 @@ void TypeAdapter::UpdateTypeAnnotation(panda::pandasm::Function *func, size_t an std::cout << "\n"; } } +} // namespace ts2abc_type_adapter diff --git a/ts2panda/ts2abc/type_adapter.h b/ts2panda/ts2abc/type_adapter.h index fb767c78ee..141cfcc89b 100644 --- a/ts2panda/ts2abc/type_adapter.h +++ b/ts2panda/ts2abc/type_adapter.h @@ -19,6 +19,7 @@ #include "assembler/assembly-program.h" #include "assembler/assembly-function.h" +namespace ts2abc_type_adapter { class TypeAdapter { public: TypeAdapter() {}; @@ -43,5 +44,6 @@ private: const std::unordered_map &order_type_map) const; bool display_typeinfo_ = false; }; +} // namespace ts2abc_type_adapter #endif // TS2PANDA_TS2ABC_TYPE_ADAPTER_H -- Gitee