Cedet无法正确解析/usr/include下的time.h
我配置的 cedet 与 http://alexott.net/en/writings 几乎相同/emacs-devenv/EmacsCedet.html。
谢谢alexott,大多数时候它工作得很好,但我发现它不能很好地解析/usr/include/time.h中的tm结构。
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main(void){
struct tm times;
FILE file;
}
使用Mx语义-ia-fast-jump
时,结构体FILE是正确的,但语义在wchar.h
中找到结构体tm,而不是在time.h中
。 问题似乎是在 wchar.h
中有一个针对 struct tm
的前向声明。
I configured my cedet almost the same with http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html.
Thanks alexott , most of the time it works well, but I found that it can not well parse the tm struct in /usr/include/time.h.
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main(void){
struct tm times;
FILE file;
}
When using M-x semantic-ia-fast-jump
, the struct FILE is correct, but semantic finds the struct tm in wchar.h
, not in time.h
.
The problem seems to be there is a forward declaration in wchar.h
for the struct tm
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我的 time.h 副本中,符号 __BEGIN_NAMESPACE_STD 似乎出现在结构声明前面,并且使解析器感到困惑。您只需将其和
__END_NAMESPACE_STD
添加到变量semantic-lex-c-preprocessor-symbol-map
作为映射到空即可快速解决此问题。然后删除与 time.h 相关的 Semanticdb 缓存文件(在 ~/.semanticdb 中),或者删除 /usr/include 中的所有内容,然后重新启动 emacs。 time.h 应该重新解析,之后 time.h 应该可以正常工作......除非你想使用 std::tm 或其他东西。In my copy of time.h, it appears that the symbol
__BEGIN_NAMESPACE_STD
is showing up in front of the struct declaration, and is befuddling the parser. You can fix that quickly by just adding that and__END_NAMESPACE_STD
to the variablesemantic-lex-c-preprocessor-symbol-map
as mapping to empty. Then delete your semanticdb cache files (in ~/.semanticdb) related to time.h, or just everything in /usr/include, and restart emacs. time.h should get reparsed, and things should work ok for time.h after that... unless you want to use std::tm or something.