there is in fact one source file in this project.Can you provide the whole project here (maybe stripped to a minimal example to reproduce?).
Any ideas? when does this debug log message (Unexpected behaviour!) is thrown?
there is in fact one source file in this project.Can you provide the whole project here (maybe stripped to a minimal example to reproduce?).
Any ideas? when does this debug log message (Unexpected behaviour!) is thrown?
This error is thrown by CC and should actually really never happen?! Do you have an either super-fast or super-slow PC? What yre the specs? (PC, OS/C::B version...).
Does it break the same if you put the project in a new workspace alone?
void Parser::OnBatchTimer(cb_unused wxTimerEvent& event)
{
if (Manager::IsAppShuttingDown())
return;
// Current batch parser is already exists
if (ParserCommon::s_CurrentParser && ParserCommon::s_CurrentParser != this)
{
m_BatchTimer.Start(1000, wxTIMER_ONE_SHOT);
return;
}
bool sendStartParseEvent = false;
CC_LOCKER_TRACK_P_MTX_LOCK(ParserCommon::s_ParserMutex)
if (!m_StopWatchRunning)
StartStopWatch();
bool send_event = true;
if (!m_PoolTask.empty())
{
m_Pool.BatchBegin();
PTVector& v = m_PoolTask.front();
for (PTVector::const_iterator it = v.begin(); it != v.end(); ++it)
m_Pool.AddTask(*it, true);
m_PoolTask.pop();
m_Pool.BatchEnd();
send_event = false; // error
}
else if ( !m_PriorityHeaders.empty()
|| !m_BatchParseFiles.empty()
|| !m_PredefinedMacros.IsEmpty() )
{
ParserThreadedTask* thread = new ParserThreadedTask(this, ParserCommon::s_ParserMutex);
m_Pool.AddTask(thread, true);
// Have not done any batch parsing
if (ParserCommon::s_CurrentParser)
send_event = false; // error
else
{
ParserCommon::s_CurrentParser = this;
m_StopWatch.Start(); // reset timer
sendStartParseEvent = true;
}
}
CC_LOCKER_TRACK_P_MTX_UNLOCK(ParserCommon::s_ParserMutex)
if (send_event)
{
if (sendStartParseEvent)
ProcessParserEvent(m_ParserState, ParserCommon::idParserStart);
else
ProcessParserEvent(ParserCommon::ptUndefined, ParserCommon::idParserStart, _T("Unexpected behaviour!"));
}
}
Having a look at the code it means that the only reason would be if:
m_PoolTask.empty() && m_PriorityHeaders.empty() && m_BatchParseFiles.empty() && m_PredefinedMacros.IsEmpty()
Well we can make another else-if tree for that particular case but I wonder how this can happen...?! It would mean that nothing has to be done at all - as if there would be not a single file to be parsed, including no priority headers, which is usually never the case.
@Martin K.: What are your CC settings, can you post a screenshot of all CC settings tabs?
Can you try to strip down the WS first project by projects and the file by file to (maybe) get a minimal example? If you want to, contact me via PM so I can provide you with a personal email address if you have concerns to post it here. But maybe (if possible) you can really strip it down to a non-secret minimalist example. It must not even compile - just to reproduce this state.
I have a demo, and i hope that it fails on your system also, [...]Funny.
Probably the full default.conf should be needed.I think I am able to reproduce meanwhile. I switched to "one parser per WS" and now I see this, too.
Probably the full default.conf should be needed.I think I am able to reproduce meanwhile. I switched to "one parser per WS" and now I see this, too.
However: If your projects use several compilers its not wise to do that. The reason is simple: The parser will ix #includes from different compilers then and the CC you get might be wrong.
So, although we still need to fix this later on, for you (Martin K.) a probably solution is to switch to "one parser per project", which should also be the default option.
then (sometimes!) no parsing of this project is triggered and i cannot find any declaration/implementation/... of any object in this opened source file.This "sometimes" worries me a bit ???, but you can adjust the behaviour by simply allowing more parsers.
then (sometimes!) no parsing of this project is triggered and i cannot find any declaration/implementation/... of any object in this opened source file.This "sometimes" worries me a bit ???, but you can adjust the behaviour by simply allowing more parsers.
This settings depends on the workspace/project layout you are used to use. For some people, what you call "project" are targets. Thus, having many of these parsers may not be wise for them. For you, having more projects, but rather small ones with less targets, you can safely increase the number of parsers per project and the issue should be gone.
I haven't had a deeper look inside CC but in the "on parser per project" mod it seems to parse a project/target if:I'm confused. look at the image below, and it looks like your "target" means a c::b project? ;)
- the active target changes and this target was not scanned before
- a "double click" on a target node occurs and this target was not scanned before
- any source of a not scanned target opens and this target was not scanned before
I have changed my message.Did it work after the adjustment I proposed?
I have changed my message.Did it work after the adjustment I proposed?
I have another example attached.To here, I can't see any issue.
One Workspace, two projects. Both projects are sharing the source file "together.cpp".
Start Code::Blocks, activate the log tab "Code::Blocks".
Open the workspace "ccproblem.workspace".
The logpane shows:
Opening C:\codeblocks\ccproblem\project1.cbp
Done.
Opening C:\codeblocks\ccproblem\project2.cbp
Done.
Create new parser for project 'project1'
Project 'project1' parsing stage done!
expand all Workspace nodes by clicking at the plus signs.
Now open project1s file together.cpp by double clicking at "together.cpp". The editor opens the source file. A look at the symbols browser shows the global functions "project1" and "together".
Now open together.cpp in project2, only by double clicking at the filename. The editor window don't change and even the symbol browser don't change. It still displays "project1" and "together" as available functions.
OK, another try:This is the correct behavior, cc create a parser for "project1".
open the file "project1.cpp". The editor shows this file and the symbol bwrowser shows "project1" and "together"
open the file "project2.cpp" and now something happens in the codeblocks log pane: The parser starts to parse project2. The symbol browser showas "project2" and "together" as available function.If you CC setting "max allowed parsers" number >=2, and CC detect that a file belong to another C::B project is opened, so it will create another parser for "project2", this is also correct behavior.
Do you see the difference in the behavior of the cc parser?Yes, but I don't think cc has some problems in those steps.
It ignores the project when it decides if and when to parse something.What does this sentence means? I can't understand this.