<< Back to previous view

[QB-2666] Warning as error for devenv / msbuild steps
Created: 16/Mar/16  Updated: 19/Jan/18

Status: Resolved
Project: QuickBuild
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.10

Type: Improvement Priority: Major
Reporter: Benoit Maury-Bouet Assigned To: Unassigned
Resolution: Fixed Votes: 0
Remaining Estimate: Unknown Time Spent: Unknown
Original Estimate: Unknown


 Description   
Dear all,

It would be nice in the advanced options for devenv and msbuild step to have an option to force warnings to be treated as error when parsing visualstudio log.
And it would be nice also to have an option to exclude certain warnings from triggering an error.

Because if you do have a "warning as error" flag set on your compilation the error returned by visual studio will be :
error C2220: warning treated as error - no 'object' file generated

Which is not very informative, as the valuable information is in the warning message : warning C4189: 'width': local variable is initialized but not referenced

Thanks a lot!
Ben

 Comments   
Comment by Steve Luo [ 17/Mar/16 12:50 PM ]
MSBuild seems to already have an option TreatWarningsAsErrors, see the following link:
https://msdn.microsoft.com/library/bb629394%28v=vs.100%29.aspx
but, in GitHub, this feature seems not supported correctly:
https://github.com/Microsoft/msbuild/issues/68

For Devenv, there is also an option /we which you can use to treat specified warning as error like /we4715, it means treat 4715 as error, see details on below page:
https://msdn.microsoft.com/en-us/library/thxezb7y.aspx
and
http://stackoverflow.com/questions/4750880/can-i-treat-a-specific-warning-as-an-error
Comment by Benoit Maury-Bouet [ 17/Mar/16 01:16 PM ]
Hi Steve,

Yes indeed and that's what we use, but when quickbuild parses the output of devenv or msbuild it is not aware of us using this feature.
Because of this a "warning XXXX" will not appear under the steps error messages.
Quibuild will only report the error caused by the presence of warning which is : error C2220: warning treated as error - no 'object' file generated

So instead of receiving build notifications like :

error C2220: warning treated as error - no 'object' file generated

we would like to have :
warning C4189: 'width': local variable is initialized but not referenced
error C2220: warning treated as error - no 'object' file generated

That's why I am proposing to have this in the devenv/msbuild steps so, from a quickbuild; point of view we can say "we wan't compilation warnings to be seen as error in a step"
And also a feature to may be skip certains warnings (just in case)

Hopes this clarifies our need :)

Thanks a lot
Ben
Comment by Steve Luo [ 17/Mar/16 01:29 PM ]
Hi Ben,

I'm still a little confused. When you say build notification, is it mean in Build dashboard or in log?
Does below message exist in build log or not?
warning C4189: 'width': local variable is initialized but not referenced
Comment by Benoit Maury-Bouet [ 17/Mar/16 01:44 PM ]
Hi Steve,

If I look at the step log I do see the warning.
But when we receive an email notification or view the build overview we only see the eror message.

For instance here's a sample of a buid failed email :
---------------
[ log ] NativeFramework
Executing below devenv command failed:
(13 succeeded or up-to-date, 3 failed, 0 skipped).
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com" D:\Odyssey\Code\Main\tools\NativeFramework\NativeTools.sln /Rebuild Release|x64 /out log.txt

See detailed errors below:
11>LINK : error LNK1218: warning treated as error; no output file generated
--------------

Has you see here only the link error is returned but it's not very useful :(



Comment by Steve Luo [ 17/Mar/16 01:52 PM ]
Hi Ben,

Now I know the problem clearly. Thank you very much.

Comment by Benoit Maury-Bouet [ 19/Jan/18 08:31 AM ]
Hi Steve,
It's been a long time we just had this issue back (we didn't have it for a while as we recently switched back to no warnings on our build policy)

And we don't see the warning in case of a c220 :

Executing below MSBuild command failed (1 errors, 1 warnings):
    "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" /nologo /t:build /noconsolelogger /l:QBLogger,C:\buildagent\framework\configuration\org.eclipse.osgi\com\pmease\quickbuild\plugin\builder\msbuild\PMEase.QuickBuild.MSBuild.Logger.dll;v=normal /p:Configuration=Release;Platform=x64 /fileLoggerParameters:LogFile=C:\Users\bin-mtp\AppData\Local\Temp\logresult\result_x64_Release.log;Verbosity=normal /m:8 D:\Odyssey\Code\Main\projects\Engine.sln

See detailed errors below:
..\..\..\src\Odyssey\Crew\CrewMenu\CrewMenuController.cpp(129,0): error C2220: warning treated as error - no 'object' file generated

Thanks
Generated at Sat Aug 02 12:47:35 UTC 2025 using JIRA 189.