Previously reported by me in this forum topic:
http://forums.codeblocks.org/index.php?topic=23278.0
What I'm trying to report is that it appears to be a bug that prevents compilation errors from being reported correctly in the editor in the CodeBlocks IDE, in the following specific case.
It happens only when using Menu - Build - "Compile current file" and not when using Build or Rebuild - the other compiling methods. Additionally, the project compiler must be set to different than the Target compiler, in the Project Build Options window.
To summarize, following is needed:
1. Using Menu - Build - "Compile current file"
2. Project compiler set to different than Target compiler.In my case specifically, what I have set is the "Np Compiler" compiler as Project compiler and the "GNU GCC Compiler" compiler as the Target compiler. I have tested this on my customized CodeBlocks IDE v17.12 for Windows and on the 20 April 2019 build - it appears it persists there too. Please check attached screenshot animation below (about 46s long).
Screenshot animation:
https://drive.google.com/file/d/1GDRz9m48bIihCaUU7zkJnQbVok34Jj38/view?usp=sharing
second post:
After further investigating it myself, it seems that IDE is parsing compiler output using wrong settings. It seems it pulls regex, that parse the output, from what is set in the current Project compiler, while instead it should use Target comnpiler settings. Compiler settings for error parsing I'm talking about are here, in C::B IDE: Menu - Settings - Compiler... - then the "Other settings" tab - then "Advanced options..." button.
So, if it happens that the project has the same compiler set in both those places it works as expected, because it ends up using correct regex anyway. If it indeed functions how I see it so far.
Ok, i found out that in plugins\compilergcc\compilergcc.cpp:3527
the
m_CompilerId
is "null" so it seems that it is not updated correctly on compiling only a file...Does not work in this case...
The compiler should be switched in
if the current target/target for file is different then the project compiler then it should get switched here...
This is again some quite complex thing going on here
This check project function is called a lot times....
And isn't it compleatly broken? This function is called before compiling a file to check if the right project and compiler is selected. But it checks only for project compiler and not for target compiler...
So if the target has a other compiler then the project it always will take the wrong compiler because of: