From 6d8fb94d86d753b57110decbb636aa999cc8ef3f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 20 Jul 2020 14:51:17 +0200 Subject: [PATCH] Fix a few Coverity warnings. --- common/libeval_compiler/libeval_compiler.cpp | 14 +++++++++----- qa/qa_utils/mocks.cpp | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/libeval_compiler/libeval_compiler.cpp b/common/libeval_compiler/libeval_compiler.cpp index e546828c04..35f4dbeb93 100644 --- a/common/libeval_compiler/libeval_compiler.cpp +++ b/common/libeval_compiler/libeval_compiler.cpp @@ -161,6 +161,9 @@ COMPILER::COMPILER() m_parseFinished = false; m_unitResolver.reset( new UNIT_RESOLVER ); m_parser = LIBEVAL::ParseAlloc( malloc ); + m_parseError = false; + m_parseErrorPos = 0; + m_tree = nullptr; } @@ -370,7 +373,7 @@ bool COMPILER::lexDefault( COMPILER::T_TOKEN& aToken ) break; } - libeval_dbg(10, "LEX ch '%c' pos %d\n", ch, m_tokenizer.GetPos() ); + libeval_dbg(10, "LEX ch '%c' pos %lu\n", ch, (unsigned long)m_tokenizer.GetPos() ); if( ch == 0 ) { @@ -602,19 +605,20 @@ bool COMPILER::generateUCode( UCODE* aCode ) { auto node = stack.back(); - libeval_dbg( 4, "process node %p [op %d] [stack %d]\n", node, node->op, stack.size() ); + libeval_dbg( 4, "process node %p [op %d] [stack %lu]\n", + node, node->op, (unsigned long)stack.size() ); // process terminal nodes first switch( node->op ) { case TR_OP_FUNC_CALL: break; + case TR_STRUCT_REF: { assert( node->leaf[0]->op == TR_IDENTIFIER ); //assert( node->leaf[1]->op == TR_IDENTIFIER ); - switch( node->leaf[1]->op ) { case TR_IDENTIFIER: @@ -658,8 +662,6 @@ bool COMPILER::generateUCode( UCODE* aCode ) break; } } - - break; } @@ -682,12 +684,14 @@ bool COMPILER::generateUCode( UCODE* aCode ) break; } + case TR_STRING: { node->uop = makeUop( TR_UOP_PUSH_VALUE, node->value.str ); node->isTerminal = true; break; } + default: node->uop = makeUop( node->op ); break; diff --git a/qa/qa_utils/mocks.cpp b/qa/qa_utils/mocks.cpp index dc6775edbb..2168c44bd7 100644 --- a/qa/qa_utils/mocks.cpp +++ b/qa/qa_utils/mocks.cpp @@ -192,6 +192,7 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxStr m_findPrevious = nullptr; m_searchAgain = nullptr; m_closeButton = nullptr; + m_status = nullptr; }