The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,534 other followers

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+:

Stefan Glienke's profile photo

+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.

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.


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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: