diff --git a/idl_tool_2/codegen/HDI/cpp/hdi_cpp_code_emitter.h b/idl_tool_2/codegen/HDI/cpp/hdi_cpp_code_emitter.h index f2521a9..e30f826 100644 --- a/idl_tool_2/codegen/HDI/cpp/hdi_cpp_code_emitter.h +++ b/idl_tool_2/codegen/HDI/cpp/hdi_cpp_code_emitter.h @@ -24,8 +24,6 @@ class HDICppCodeEmitter : public HDICodeEmitter { public: ~HDICppCodeEmitter() override = default; - bool OutPut(const AutoPtr &ast, const std::string &targetDirectory); - protected: void GetImportInclusions(HeaderFile::HeaderFileSet &headerFiles); diff --git a/idl_tool_2/codegen/SA/cpp/sa_cpp_code_emitter.cpp b/idl_tool_2/codegen/SA/cpp/sa_cpp_code_emitter.cpp index ced042b..ee31c15 100644 --- a/idl_tool_2/codegen/SA/cpp/sa_cpp_code_emitter.cpp +++ b/idl_tool_2/codegen/SA/cpp/sa_cpp_code_emitter.cpp @@ -27,17 +27,13 @@ namespace Idl { void SACppCodeEmitter::GetStdlibInclusions(HeaderFile::HeaderFileSet &headerFiles) { const AST::TypeStringMap &types = ast_->GetTypes(); + + // Add header files dependency by default to avoid compatibility problems + headerFiles.emplace(HeaderFileType::OTHER_MODULES_HEADER_FILE, "string_ex"); + headerFiles.emplace(HeaderFileType::CPP_STD_HEADER_FILE, "cstdint"); for (const auto &pair : types) { AutoPtr type = pair.second; switch (type->GetTypeKind()) { - case TypeKind::TYPE_STRING: { - headerFiles.emplace(HeaderFileType::OTHER_MODULES_HEADER_FILE, "string_ex"); - break; - } - case TypeKind::TYPE_BYTE: { - headerFiles.emplace(HeaderFileType::CPP_STD_HEADER_FILE, "cstdint"); - break; - } case TypeKind::TYPE_ARRAY: case TypeKind::TYPE_LIST: { headerFiles.emplace(HeaderFileType::CPP_STD_HEADER_FILE, "vector"); diff --git a/idl_tool_2/parser/intf_type_check.cpp b/idl_tool_2/parser/intf_type_check.cpp index e322782..b229834 100644 --- a/idl_tool_2/parser/intf_type_check.cpp +++ b/idl_tool_2/parser/intf_type_check.cpp @@ -348,8 +348,8 @@ bool IntfTypeChecker::CheckIntfSmAstTypes() bool IntfTypeChecker::CheckSmInterfaceAst() { - int index; - for (int i = 0; i < ast_->GetInterfaceDefNumber(); i++) { + size_t index = 0; + for (size_t i = 0; i < ast_->GetInterfaceDefNumber(); i++) { if (!ast_->GetInterfaceDef(i)->IsExternal()) { index = i; break; diff --git a/idl_tool_2/util/file.cpp b/idl_tool_2/util/file.cpp index a048bb5..bef6dff 100644 --- a/idl_tool_2/util/file.cpp +++ b/idl_tool_2/util/file.cpp @@ -118,7 +118,7 @@ char File::PeekChar() bool File::IsEof() const { - return isEof_ || buffer_[position_] == -1; + return isEof_ || buffer_[position_] == static_cast(-1); } size_t File::Read()