如何过滤Delphi 2010编译器输出(提示)?

发布于 2024-09-04 16:51:17 字数 322 浏览 9 评论 0原文

我试图摆脱 Delphi 编译器发出的一些提示(*)。浏览 ToolsAPI 我看到一个 IOTAToolsFilter ,看起来它可以帮助我通过它的通知程序完成此任务,但我不确定如何调用它(通过我的 xxxServices )可以访问过滤器)。

谁能告诉我我是否走在正确的轨道上?谢谢!

(*) 特别是,H2365 关于重写的方法与父级的大小写不匹配。当您有大约 500 万行活动代码且其代码约定与 Embarcadero 的代码约定略有不同时,情况就不太好了。我们已经在没有提示的情况下工作了几个月,我们有点想念他们。 :-)

I'm trying to get rid of some hints(*) the Delphi compiler emits. Browsing through the ToolsAPI I see a IOTAToolsFilter that looks like it might help me accomplish this through it's Notifier, but I'm not sure how to invoke this (through what xxxServices I can access the filter).

Can anyone tell me if I´m on the right track here? Thanks!

(*) In particular, H2365 about overridden methods not matching the case of the parent. Not so nice when you have about 5 million lines of active code with a slightly different code convention than Embarcadero's. We've been working without hints for months now, and we kinda miss 'm. :-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神仙妹妹 2024-09-11 16:51:17

即使您可以查询 BorlandIDEServices 的 IOTAToolsFilter,该界面也不会帮助您完成您所要求的操作。该接口是作为向 IDE 添加其他构建工具(编译器等)的机制的一部分而引入的(在 IDE 使用 MSBuild 之前)。它允许您编写自定义“过滤器”来处理特定构建工具的输出,但它不允许您将过滤器应用于内置工具之一(如 delphi 编译器)。

Delphi2010 中 Supports(BorlandIDEServices, IOTAToolsFilter, OTAToolsFilter) 调用失败的原因是,一旦将 MSBuild 支持添加到 IDE 中,向 IDE 添加构建工具的旧方法就被禁用,并且 BorlandIDEServices 接口不再支持 IOTAToolsFilter。

IOTAToolsFilter 的声明可能应该在 ToolsAPI.pas 中被标记为已弃用(或者至少应该在源代码注释中提到不再支持它)。

至于您想要过滤特定提示,我不知道有什么方法可以通过 ToolsAPI 来做到这一点。这似乎是一个合理的事情,可以添加到 IOTAMessageServices(能够枚举、过滤并可能更改 IDE 消息视图中的消息)。我会为此在 QualityCentral 中输入请求。

另外,请投票给 QC #35774 (http://qc.embarcadero.com /wc/qcmain.aspx?d=35774),就像已实现一样,您不需要使用 ToolsAPI 来完成此类事情。

Even if you could query BorlandIDEServices for IOTAToolsFilter, that interface isn't going to help you do what you're asking. That interface was introduced as part of a mechanism for adding additional build tools (compilers, etc.) to the IDE (before the IDE used MSBuild). It allowed you to write a custom "filter" to handle output from a particular build tool, but it would not let you apply a filter to one of the built-in tools (like the delphi compiler).

The reason the Supports(BorlandIDEServices, IOTAToolsFilter, OTAToolsFilter) call fails in Delphi2010 is that once MSBuild support was added to the IDE, the old way of adding build tools to the IDE was disabled, and the BorlandIDEServices interface no longer supported IOTAToolsFilter.

The declaration of IOTAToolsFilter should probably have been marked deprecated in ToolsAPI.pas (or least it should have been mentioned in the source code comment that it is no longer supported).

As far as your desire to filter a particular hint, I'm not aware of a way to do that via the ToolsAPI. It seems like a reasonable thing that can be added to IOTAMessageServices (the ability to enumerate, filter, and possibly change the messages in the IDE's Message View). I would enter a request in QualityCentral for that.

Also, please vote for QC #35774 (http://qc.embarcadero.com/wc/qcmain.aspx?d=35774), as if that were implemented, you would not need to use the ToolsAPI for this sort of thing.

ˉ厌 2024-09-11 16:51:17

根据 http://docwiki.embarcadero.com/RADStudio/en/Obtaining_Tools_API_Services应该可以使用 BorlandIDEServices 直接访问它,例如:

var
  OTAToolsFilter: IOTAToolsFilter;
begin    
if Supports(BorlandIDEServices, IOTAToolsFilter, OTAToolsFilter) then
  ShowMessage('supports IOTAToolsFilter')
else
  ShowMessage('IOTAToolsFilter NOT supported');
end;

但是,这不会在 Delphi 2010 中返回所需的接口(您将收到不支持的消息),因此文档中存在错误,或者 BorlandIDEServices 中没有错误返回正确的接口。

According to http://docwiki.embarcadero.com/RADStudio/en/Obtaining_Tools_API_Services it should be possible to access it directly using BorlandIDEServices, eg:

var
  OTAToolsFilter: IOTAToolsFilter;
begin    
if Supports(BorlandIDEServices, IOTAToolsFilter, OTAToolsFilter) then
  ShowMessage('supports IOTAToolsFilter')
else
  ShowMessage('IOTAToolsFilter NOT supported');
end;

However this doesn't return the desired interface in Delphi 2010 (you'll get the not supported message), so there's either an error in the documentation, or an error in BorlandIDEServices not returning the correct interface.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文