It’s also worth mentioning that you can have only certain warnings treated as errors. The switch to do this on the command line would look something like this: -W^^WARNING-NAME
. You would substitute the string that is associated with the warning you are wanting to have treated as an error.
On turning “W1025 Unsupported language feature: ‘customattribute'” into a compiler error.
Posted by jpluimers on 2014/04/10
On turning W1025 into an error [WayBack] Why is “W1025 Unsupported language feature: ‘custom attribute’ “only a warning?… – mezen – Google+:
+Fabian S. Biehn This question has been answered by Nick already.
However you don’t need to turn it on in ALL projects. You change it in the base configuration, tick the Default checkbox in the bottom left corner of the settings dialog and from then on every new project will have this warning treated as error. However for existing projects you have to change it retrospectively.
You can even pass this option to the commandline compiler as explained here: http://stackoverflow.com/a/360947/587106
[WayBack] compiler construction – Delphi 2009 where is the ‘treat warnings as errors’ option? – Stack Overflow
On a related note, if you are using the command line compiler (DCC32.exe) the switch is-W^
to have warnings treated as errors. If you are using this, it’s important to note that the default command shell in Windows (cmd.exe) treats the caret (^) as an escape character, so you have to use-W^^
instead if you are executing the compiler directly from the command line, a batch file or even the from the Pre-Build or Post-Build events in the IDE.
The point about
-W^
being problematic within BAT files is a good one. Using-W^^
works if you are modifying the compile line directly. Otherwise, I found that using surrounding double quotes"-W^"
works, for example when building an env var that contains all compiler parameters, that env var being subsequently passed to dcc32.exe. Tested with XE, XE2, XE3, XE4.SET CompilerParams=-B -M "-W^" -U"..\Source;%dcuoutdir%;%DUnitPath%" -I"..\Source\inc" "-N0%dcuoutdir%" -DDebugMode "%dcc%bin\dcc32.exe" %FuTFolder%ADDTests.dpr %CompilerParams% -U"%FuTSource%" %ExtraPath32%>%DCCLogFilename% if errorlevel 1 %Alerter% %DCCLogFilename%
–jeroen
Leave a comment