Fixed some errors reported by colobot-lint
parent
344cda4ae6
commit
048534e89d
|
@ -55,7 +55,8 @@ void CBotDebug::DumpCompiledProgram(CBotProgram* program)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<CBotInstr*> finished;
|
std::set<CBotInstr*> finished;
|
||||||
std::function<void(CBotInstr*)> DumpInstr = [&](CBotInstr* instr) {
|
std::function<void(CBotInstr*)> DumpInstr = [&](CBotInstr* instr)
|
||||||
|
{
|
||||||
if (finished.find(instr) != finished.end()) return;
|
if (finished.find(instr) != finished.end()) return;
|
||||||
finished.insert(instr);
|
finished.insert(instr);
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,8 @@ enum TokenId
|
||||||
/**
|
/**
|
||||||
* \brief Types of tokens
|
* \brief Types of tokens
|
||||||
*/
|
*/
|
||||||
enum TokenType {
|
enum TokenType
|
||||||
|
{
|
||||||
TokenTypNone = 0,
|
TokenTypNone = 0,
|
||||||
TokenTypKeyWord = 1, //!< keyword of the language (see TokenKeyWord)
|
TokenTypKeyWord = 1, //!< keyword of the language (see TokenKeyWord)
|
||||||
TokenTypNum = 2, //!< number
|
TokenTypNum = 2, //!< number
|
||||||
|
|
|
@ -168,4 +168,4 @@ bool CBotExternalCallDefault::Run(CBotVar* thisVar, CBotStack* pStack)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,8 @@ static const std::map<TokenId, const std::string> KEYWORDS = {
|
||||||
{TX_NAN, "not a number"}
|
{TX_NAN, "not a number"}
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
static const std::string emptyString = "";
|
static const std::string emptyString = "";
|
||||||
}
|
}
|
||||||
const std::string& LoadString(TokenId id)
|
const std::string& LoadString(TokenId id)
|
||||||
|
|
|
@ -96,7 +96,8 @@ long GetNumInt(const std::string& str);
|
||||||
*/
|
*/
|
||||||
float GetNumFloat(const std::string& str);
|
float GetNumFloat(const std::string& str);
|
||||||
|
|
||||||
template<typename T> class CBotLinkedList {
|
template<typename T> class CBotLinkedList
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* \brief Destructor. Be careful, destroys the whole linked list!
|
* \brief Destructor. Be careful, destroys the whole linked list!
|
||||||
|
@ -134,7 +135,8 @@ protected:
|
||||||
T* m_next = nullptr;
|
T* m_next = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T> class CBotDoublyLinkedList {
|
template<typename T> class CBotDoublyLinkedList
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* \brief Destructor. Be careful, destroys the whole linked list!
|
* \brief Destructor. Be careful, destroys the whole linked list!
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
namespace CBot
|
namespace CBot
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
std::unique_ptr<CBotFileAccessHandler> g_fileHandler;
|
std::unique_ptr<CBotFileAccessHandler> g_fileHandler;
|
||||||
std::unordered_map<int, std::unique_ptr<CBotFile>> g_files;
|
std::unordered_map<int, std::unique_ptr<CBotFile>> g_files;
|
||||||
int g_nextFileId = 1;
|
int g_nextFileId = 1;
|
||||||
|
|
|
@ -3448,4 +3448,4 @@ void CScriptFunctions::DestroyObjectVar(CBotVar* botVar, bool permanent)
|
||||||
bool CScriptFunctions::CheckOpenFiles()
|
bool CScriptFunctions::CheckOpenFiles()
|
||||||
{
|
{
|
||||||
return CBotFileColobot::m_numFilesOpen > 0;
|
return CBotFileColobot::m_numFilesOpen > 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,8 @@ protected:
|
||||||
CBotToken* token = tokens.get()->GetNext(); // TODO: why do we always have to skip the first one :/
|
CBotToken* token = tokens.get()->GetNext(); // TODO: why do we always have to skip the first one :/
|
||||||
ASSERT_TRUE(token != nullptr);
|
ASSERT_TRUE(token != nullptr);
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
ASSERT_LT(i, data.size()) << "too many tokens processed";
|
ASSERT_LT(i, data.size()) << "too many tokens processed";
|
||||||
|
|
||||||
TokenTest correct = data[i];
|
TokenTest correct = data[i];
|
||||||
|
@ -120,4 +121,4 @@ TEST_F(CBotTokenUT, BasicProgram)
|
||||||
{";", ID_SEP},
|
{";", ID_SEP},
|
||||||
{"}", ID_CLBLK},
|
{"}", ID_CLBLK},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class CBotTestFail : public std::runtime_error {
|
class CBotTestFail : public std::runtime_error
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
CBotTestFail(const std::string& message) : runtime_error(message)
|
CBotTestFail(const std::string& message) : runtime_error(message)
|
||||||
{
|
{
|
||||||
|
@ -982,4 +983,4 @@ TEST_F(CBotUT, DISABLED_TestNANParam_Issue642)
|
||||||
" ASSERT(test(nan) == nan);\n"
|
" ASSERT(test(nan) == nan);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@ set(UT_SOURCES
|
||||||
main.cpp
|
main.cpp
|
||||||
app/app_test.cpp
|
app/app_test.cpp
|
||||||
CBot/CBotToken_test.cpp
|
CBot/CBotToken_test.cpp
|
||||||
CBot/CBot.cpp
|
CBot/CBot_test.cpp
|
||||||
common/config_file_test.cpp
|
common/config_file_test.cpp
|
||||||
graphics/engine/lightman_test.cpp
|
graphics/engine/lightman_test.cpp
|
||||||
math/func_test.cpp
|
math/func_test.cpp
|
||||||
|
|
Loading…
Reference in New Issue