Author Topic: Inaccurate error / warning counts reported for VC++2015  (Read 331 times)

Offline aaron_baker

  • Single posting newcomer
  • *
  • Posts: 4
Inaccurate error / warning counts reported for VC++2015
« on: April 10, 2017, 02:04:58 am »
Hello,

I've been trying to figure this out for several days now, searching many different websites like this one, as well as stack overflow and the codeblocks wiki, but cannot find a solution for my problem.

Codeblocks reports the number of warnings / errors no matter what compiler you have selected, it seems.

When upgrading VC++2010 to 2013 I had no issues with codeblocks, but I have had issues upgrading from 2013 to 2015.
There have been many VC++ issues I've resolved, but this mis-reporting of error and warnings seems to be an error with the codeblocks configuration I've created. (Error / warnings are almost always 0, though errors in the linker are sometimes counted).

Linking with: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10150.0\ucrt\x86\libucrt.lib

Search directories:
Compiler:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include

Linker:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib



Toolchain Executables:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC

c compiler cl.exe, C++ compiler cl.exe, linker for dynamic & static libs link.exe, Debuger (invalid debuger), make program nmake.exe.


I would sincerely appreciate any help getting VC++2015 to work correctly with Code Blocks 16.01.

All the best,
Aaron

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5710
    • My Best Post
Re: Inaccurate error / warning counts reported for VC++2015
« Reply #1 on: April 10, 2017, 03:47:22 am »
Post an error or warning that CB does NOT handle correctly.
Use what is in the "Build Log".

Then, maybe someone will help you figure out how the advanced compiler settings needs changed to support the new message.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online sodev

  • Multiple posting newcomer
  • *
  • Posts: 58
Re: Inaccurate error / warning counts reported for VC++2015
« Reply #2 on: April 10, 2017, 04:04:22 am »
The message format of VS2015 has slightly changed, most of the time its some extra or missing whitespace that the old VS2010 regular expressions cant handle. Its not that hard to fix, i can post my fixed regular expressions when im at work today.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 9871
Re: Inaccurate error / warning counts reported for VC++2015
« Reply #3 on: April 10, 2017, 09:44:12 am »
sodev: If you post a patch I'll happily apply it.
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline aaron_baker

  • Single posting newcomer
  • *
  • Posts: 4
Re: Inaccurate error / warning counts reported for VC++2015
« Reply #4 on: April 10, 2017, 01:48:19 pm »
Hello,

From what I'm reading I take it there's not a fix without editing the source code?

Keep in mind, I'm wanting to run VC++2013 and VC++2015 for different projects, so I'd think the only way to fix the regular expression things in that instance would be to add another built in compiler? Then again I don't know how the internals of codeblocks works so I could be wrong.

I'm not sure if its actually needed at this point, but here is an example.



Script, main.cpp
#include <stdio.h>
int main()
{
printf("Hello World!");
getchar("somestring");// getchar should have an empty parameter list, this usage is erronious.
return 0;
}

What codeblocks / VC++2015 say:
main.cpp
main.cpp(5): error C2660: 'getchar': function does not take 1 arguments
Process terminated with status 2 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
Best,
Aaron

Online sodev

  • Multiple posting newcomer
  • *
  • Posts: 58
Re: Inaccurate error / warning counts reported for VC++2015
« Reply #5 on: April 10, 2017, 09:00:20 pm »
There is no need to edit the CodeBlocks source to get VS2015 working, everything can be done with adding settings. Only if you want to add VS2015 "nicely" so that it can auto-detect the paths and gets a nicer name it requires code changes, otherwise you can just create a copy from the VS2010 compiler and make the changes yourself.

Lets start with your main issue, the error parser. All these settings go into Settings -> Compiler -> Global compiler settings | [your selected compiler] | Tab Other Settings -> Advanced Options | Tab Output parsing. You need do add some entries to the Parsing expressions list, order DOES MATTER.

Add the following entries AT START of the list to grab the new info messages:
Code: [Select]
Description: Compiler info
Type: Info
Regular expression: ([][{}() \t#%$!~[:alnum:]&_:+/\.-]+)\(([0-9]+)\)[ \t]*:[ \t]([Nn]ote:[ \t].*)
Sub-expression indices:
Message: 3
Additional message 2: 0
Additional message 3: 0
Filename: 1
Line: 2

Description: Compiler info no line
Type: Info
Regular expression: ([][{}() \t#%$!~[:alnum:]&_:+/\.-]+)[ \t]*:[ \t]([Nn]ote:[ \t].*)
Sub-expression indices:
Message: 2
Additional message 2: 0
Additional message 3: 0
Filename: 1
Line: 0

Modify the regular expression of the following two already present entries:
Code: [Select]
Parsing Expression "Compiler warning":
Regular expression: ([][{}() \t#%$!~[:alnum:]&_:+/\.-]+)\(([0-9]+)\)[ \t]*:[ \t]([Ww]arning[ \t].*)

Parsing Expression "Compiler error":
Regular expression: ([][{}() \t#%$!~[:alnum:]&_:+/\.-]+)\(([0-9]+)\)[ \t]*:[ \t](.*[Ee]rror[ \t].*)

To detect the new warning messages without line add the following entry directly below "Compiler warning":
Code: [Select]
Description: Compiler warning no line
Type: Warning
Regular expression: ([][{}() \t#%$!~[:alnum:]&_:+/\.-]+)[ \t]*:[ \t]([Ww]arning[ \t].*)
Sub-expression indices:
Message: 2
Additional message 2: 0
Additional message 3: 0
Filename: 1
Line: 0

Bonus: If you are also using mt.exe in Post-Commands to embed the Manifest into the EXE and want to catch its errors because stupid Windows 10 again blocked write access to the file or whatever, you can add the following entry at the end of the list:
Code: [Select]
Description: Manifest error
Type: Error
Regular expression: mt.exe[ \t]*:[ \t]*(.*)
Sub-expression indices:
Message: 1
Additional message 2: 0
Additional message 3: 0
Filename: 0
Line: 0

These entries should catch all notes/warnings/errors VS2015 produces, it might miss some linker errors, im getting these only rarely so i don't know if there are any that don't work with the old expressions.

But to sucessfully compile i think your are missing some directories in your search paths, for the compiler you should also need
Code: [Select]
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt
and for the linker
Code: [Select]
C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x86
Directory names might differ in the version and architecture part.

@oBFusCATed: Sorry but i don't know where these settings are done in code and don't have time atm to look for that
« Last Edit: April 11, 2017, 04:25:48 am by sodev »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 9871
Re: Inaccurate error / warning counts reported for VC++2015
« Reply #6 on: April 10, 2017, 09:02:32 pm »
@oBFusCATed: Sorry but i don't know where these settings are done in code and don't have time atm to look for that
I think all these are stored in xml files and not in the code. So if you can try to find them and provide a patch against these xml files it will be really helpful.
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline aaron_baker

  • Single posting newcomer
  • *
  • Posts: 4
Re: Inaccurate error / warning counts reported for VC++2015
« Reply #7 on: April 11, 2017, 03:29:55 am »
Hello!

Thanks for the help, I've almost got it, I'm just having a slight issue. I can't seem to order the regular expressions correctly. I tried to insert the info ones before compiler warning, but they still appeared at the bottom, below the linker expressions. I can't figure out how to move them up, either. Any help would be appreciated.

Best,
Aaron

Online sodev

  • Multiple posting newcomer
  • *
  • Posts: 58
Re: Inaccurate error / warning counts reported for VC++2015
« Reply #8 on: April 11, 2017, 04:33:59 am »
While making the patch i discovered some small errors in my expressions, i fixed them in my previous post.

There are these two buttons at the right side of the list, select an entry and move it around with the buttons.

These settings are indeed all in one xml file, it gets used for all MSVC compilers. Since my expressions still match the old format as well there is no harm done changing them, the added expressions simply wont do anything with the old compilers. However i got some strange results using the updated CodeBlocks with my old configuration (duplicate entries what wont go away), resetting all entries to default solved it though. You can find the patch here: https://sourceforge.net/p/codeblocks/tickets/496/