Author Topic: tiny problem for DoPase() in cc  (Read 7622 times)

Offline blueshake

  • Regular
  • ***
  • Posts: 459
tiny problem for DoPase() in cc
« on: February 18, 2010, 10:12:14 am »
@morten

are you sure we still need to check this in DoParse().
Code
                else if (   m_pTokensTree
                         && (   (peek==ParserConsts::semicolon)
                             || (   (m_Options.useBuffer && (peek.GetChar(0) == _T('(')))
                                 && (!m_Str.Contains(ParserConsts::dcolon)) ) ) )


here I don't think we need check m_pTokensTree

because it has been done in Parse() which called Doparse()
Code
bool ParserThread::Parse()
{
    TRACE(_T("Parse() : Parsing '%s'"), m_Filename.wx_str());

    if (!InitTokenizer())
        return false;

    bool result = false;
    m_ParsingTypedef = false;

    do
    {
        if (!m_pTokensTree || !m_Tokenizer.IsOK())
            break;

        if (!m_Options.useBuffer) // Parse a file
        {
            s_MutexProtection.Enter();
            m_FileIdx = m_pTokensTree->ReserveFileForParsing(m_Filename);
            s_MutexProtection.Leave();
            if (!m_FileIdx)
                break;
        }

        DoParse();

        if (!m_Options.useBuffer) // Parsing a file
        {
            s_MutexProtection.Enter();
            m_pTokensTree->FlagFileAsParsed(m_Filename);
            s_MutexProtection.Leave();
        }
        result = true;
    } while (false);

    return result;
}


   if (!m_pTokensTree || !m_Tokenizer.IsOK())
            break;



Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: tiny problem for DoPase() in cc
« Reply #1 on: February 18, 2010, 12:04:00 pm »
are you sure we still need to check this in DoParse().
As it is a thread which may have gotten terminated or is in the process of termination another check is safe and won't harm. Do you believe it eats all processor power?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: tiny problem for DoPase() in cc
« Reply #2 on: February 18, 2010, 01:28:31 pm »
Quote
Do you believe it eats all processor power?

No。 :D
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?