#ifdef 上的 cedet 解析问题
我是 emacs cedet 用户。我从 cedet 得到了很大的帮助。
但是,我在 cedet 中发现 #ifdef 处理时出现一些错误。 不确定是来自 cedet 内部还是我的配置错误。 我引用了 Curl 中发生此问题的一些代码。
#ifdef CURL_DO_LINEEND_CONV
if((data->set.crlf) || (data->set.prefer_ascii)) {
#else
if(data->set.crlf) {
#endif /* CURL_DO_LINEEND_CONV */
endofline_native = "\n";
对于这段代码,一定存在一些错误的括号匹配。因为我在使用 (eassist-list-methods) 或其他 cedet-semantic 函数(跳转到定义)时遇到错误。
我可以很容易地猜测这可能来自 #ifdef .. #endif 块中的两个大括号。 我把这些签约为这样。
#ifdef CURL_DO_LINEEND_CONV
if((data->set.crlf) || (data->set.prefer_ascii))
#else
if(data->set.crlf)
#endif /* CURL_DO_LINEEND_CONV */
{
endofline_native = "\n";
之后,cedet 语义函数就可以正常工作了。
对此有什么想法吗?是来自 cedet 解析器问题吗?
如果我必须在 cedet 中配置某些点,您能给我一些见解吗?
谢谢
I 'm emacs cedet user. i got great help from cedet.
but, I found some error prcessing #ifdef handling in cedet.
not sure it's from cedet internal or my mis-configuration.
I quote some code in Curl where this issue happens.
#ifdef CURL_DO_LINEEND_CONV
if((data->set.crlf) || (data->set.prefer_ascii)) {
#else
if(data->set.crlf) {
#endif /* CURL_DO_LINEEND_CONV */
endofline_native = "\n";
With this code, there must be some mis-parenthesis match. Because I got errors using (eassist-list-methods) or other cedet-semantic functions (jump to definition).
I could easily guess this might be from two braces in #ifdef .. #endif block.
I contracted these to like this.
#ifdef CURL_DO_LINEEND_CONV
if((data->set.crlf) || (data->set.prefer_ascii))
#else
if(data->set.crlf)
#endif /* CURL_DO_LINEEND_CONV */
{
endofline_native = "\n";
after this, cedet semantic functions works well.
any idea about this? is it from cedet parser problem?
if there is some point I have to configure in cedet, could you give me some insight ?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有点晚了,但如果有人仍在为此苦苦挣扎,请将以下行添加到您的 emacs init 文件中:
A bit late to the party, but in case anyone is still struggling with this, add the following line to to your emacs init file:
这似乎是设置
semantic-lex-c-preprocessor-symbol-file
的问题可以解决。
根据我读到的有关 CEDET 的内容,它不仅仅扩展每个宏
不管你愿意不愿意,但仅限于在
semantic-lex-c-preprocessor-symbol-file
中定义的。因此,您应该添加定义了
CURL_DO_LINEEND_CONV
的文件到此列表中。这是一个例子:
希望这有帮助。
This seems like a problem that setting
semantic-lex-c-preprocessor-symbol-file
could solve.
According to what I've read about CEDET, it doesn't just expand every macro
willy nilly, but only those defined in
semantic-lex-c-preprocessor-symbol-file
.So you should add the file, where
CURL_DO_LINEEND_CONV
is defined to this list.Here's an example:
Hope this helps.