Eclipse 调用层次结构会跳过未定义的 #ifdef 区域中的调用

发布于 2024-09-02 11:12:37 字数 479 浏览 1 评论 0原文

Eclipse CDT 中的“调用层次结构”和“声明”功能会忽略未定义(灰显)#ifdef 区域中存在的结果。

示例:

void blah(void) {
#ifndef ABC  
   foo();
#else         //line is greyed out
   bar();     //line is greyed out
#endif        //line is greyed out
}

foo() 的调用层次结构会将 blah() 列为调用者; bar() 的调用层次结构不会列出 blah()。

我并不期望它能够完全解析将编译哪些 #define 块,我只是希望它返回我正在搜索的函数的所有调用/声明,而不管它周围的 #define 块如何。

其他 IDE(例如 SlickEdit)可以执行此操作。

有谁知道让 Eclipse 采用这种行为的方法吗?

谢谢。

The "call hierarchy" and "declaration" features in Eclipse CDT omit results that exist in undefined (greyed out) #ifdef regions.

Example:

void blah(void) {
#ifndef ABC  
   foo();
#else         //line is greyed out
   bar();     //line is greyed out
#endif        //line is greyed out
}

The call hierarchy for foo() will list blah() as a caller; the call hierarchy for bar() will not list blah().

I'm not expecting it to do full resolution of which #define blocks will get compiled, I simply would like it to return all calls/declarations of the function I'm searching for, regardless of the #define blocks that surround it.

Other IDEs such as SlickEdit are able to do this.

Does anyone know of a way to get Eclipse to adopt this behavior?

Thanks.

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

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

发布评论

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

评论(2

£烟消云散 2024-09-09 11:12:37

CDT“调用层次结构”功能上存在许多“错误”:

所有这些都与绑定解析相关(也是这种情况将改进 CDT7.0 中的隐式构造函数调用)。
由于 bar() 显然位于 无法访问的 #ifdef 块内, “绑定决议”很可能会完全忽略它。
因此,校准层次结构不完整。

There are many "bugs" opened on the CDT "Call Hierarchy" feature:

All of them are linked to the binding resolution (also the situation will improve for implicit constructor calls in CDT7.0).
And since bar() is clearly within an Unreachable #ifdef block, chances are the "binding resolution" will ignore it completely.
Hence the incomplete cal hierarchy.

素年丶 2024-09-09 11:12:37

我在 Windows 7 64Bit Ultimate 上使用 Eclipse 3.6.2 和 PDT 2.x。

我希望看到调用该方法的所有位置的列表,但是我基本上只看到该方法本身的声明。如果我切换到“被调用者”层次结构,情况也是如此。即使调用该方法或调用同一文件中的方法。

I'm using Eclipse 3.6.2 with PDT 2.x on Windows 7 64Bit Ultimate.

I would expect to see a list of all the places where the method was called from, however I basically only see the declaration of the method itself. Same if I switch to 'callee' hierarchy. Even when the method is called or calls methods in the same file.

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