是否有DCC32选项将特定的编译器警告视为错误? [英] Is there a DCC32 option to treat a specific compiler warning as an error?

查看:196
本文介绍了是否有DCC32选项将特定的编译器警告视为错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于命令行构建,我想处理警告(例如构造包含抽象方法的实例)作为错误。我在Delphi 2009中没有找到一个dcc32命令行选项。有没有办法,例如使用dcc32.cfg来执行此操作?

For command-line builds, I would like to treat warnings (for example "Constructing instance containing abstract method") as errors. I have not found a dcc32 command line option for this purpose in Delphi 2009. Is there a way, for example using dcc32.cfg, to do this?

推荐答案

像这样:

dcc32 -W^^CONSTRUCTING_ABSTRACT MyProject.dpr

例如,使用此程序:

program MyProject;

type
  TMyClass = class
    procedure X; virtual; abstract;
  end;

begin
  TMyClass.Create;
end.

这里是输出:


>dcc32 MyProject.dpr
Embarcadero Delphi for Win32 compiler version 24.0
Copyright (c) 1983,2012 Embarcadero Technologies, Inc.
Myproject.dpr(9) Warning: W1020 Constructing instance of 'TMyClass' containing abstract method 'TMyClass.X'
Myproject.dpr(12)
13 lines, 0.03 seconds, 21568 bytes code, 13256 bytes data.

>dcc32 -W^^CONSTRUCTING_ABSTRACT MyProject.dpr
Embarcadero Delphi for Win32 compiler version 24.0
Copyright (c) 1983,2012 Embarcadero Technologies, Inc.
Myproject.dpr(9) Error: E1020 Constructing instance of 'TMyClass' containing abstract method 'TMyClass.X'
Myproject.dpr(12)

如果您希望将所有警告视为错误,那么您可以这样做:

If you want all warnings to be treated as errors then you do it like this:

dcc32 -W^^ MyProject.dpr

如需进一步阅读,请参阅 Delphi XE2的隐藏提示和警告选项

For further reading I refer you to Delphi XE2's hidden hints and warnings options.

这篇关于是否有DCC32选项将特定的编译器警告视为错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆