奇怪的语义错误 [英] Strange semantic error

查看:472
本文介绍了奇怪的语义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在新的Linux主机上重新安装了emacs 24.2.50,并根据 magnars启动了一个新的dotEmacs配置 emacs配置。由于我已经使用CEDET在我以前的工作流程中取得了一些成功,我开始配置它。但是,当我加载一个C ++源文件时,有一些奇怪的行为。

I have reinstalled emacs 24.2.50 on a new linux host and started a new dotEmacs config based on magnars emacs configuration. Since I have used CEDET to some success in my previous workflow I started configuring it. However, there is some strange behaviour whenever I load a C++ source file.

[本部分已解决]

按照预期,语义解析所有包含的文件所有由 semantic-add-system-include 变量指定的文件),但它会打印出以下错误信息:

[This Part Is Solved]
As expected, semantic parses all included files (and during the initial setup parses all files specified by the semantic-add-system-include variables), but it prints this an error message that goes like this:

code>警告:语义查找文件 - 鼻子在/usr/include/c++/4.7/vector的set-auto模式中调用/usr/include/c++/4.7/vector。你应该将负责的函数调用到'mode-local-init-hook'。

WARNING: semantic-find-file-noselect called for /usr/include/c++/4.7/vector while in set-auto-mode for /usr/include/c++/4.7/vector. You should call the responsible function into 'mode-local-init-hook'.

在上面的例子中,向量,但是对于我正在访问的一个文件包含的每个文件和任何后续的包括打印相应的错误消息。结果,需要相当长的时间来完成,不幸的是,该过程重复任何类型我打开一个新的缓冲区。

In the above example the error is printed for the STL vector but a corresponding error message is printed for every file included by the one I'm visiting and any subsequent includes. As a result it takes quite a long time to finish and unfortunately the process is repeated any type I open a new buffer.

[这个问题解决得太多]

此外,它似乎解析不真正工作,当我将点放在非c原语类型之上(即不是int,double,float等),而不是在模型中打印类型的定义一个错误消息

[This Problem Is Solved Too]
Furthermore it looks like the parsing doesn't really work as when I place the point above a non-c primitive type (i.e. not int,double,float, etc) instead of printing the type's definition in the modeline an error message like

空闲服务错误语义空闲局部符号突出显示空闲功能:#< buffer DEPFETResolutionAnalysis.cc> - 错误类型参数:stringp,(((0)\IndexMap\ ))
空闲服务错误语义空闲摘要空闲功能:#< buffer DEPFETResolutionAnalysis.cc> - 错误类型参数:stringp,((\fXBetween \0 nil nil))

其中 DEPFETResolutionAnalysis.cc 缓冲区我正在编辑,并且和 fXBetween 是我正在编辑的文件包括的文件中定义的类型/正在编辑的文件包括的一些文件。

where DEPFETResolutionAnalysis.cc is the file & buffer I'm currently editing and IndexMap and fXBetween are types defined in files included by the file I'm editing/some file included by the file I'm editing.

我没有测试CEDET /语义的任何进一步的功能,因为这个问题很讨厌。我的cedet配置可在此处找到。

I have not tested any further features of CEDET/semantic as the problem is pretty annoying. My cedet config can be found here.

EDIT:在Alex Ott的帮助下,我解决了第一个问题。这是由于我可怕的cedet初始化。请参阅他对配置CEDET的正确方法的第一个答案!

空闲服务错误仍然存在问题(当启用 global-semantic-idle-local-symbol-highlight-mode ,永久性出现,不仅在检查该点类型的定义时)。

如何禁用基于网站的init文件问题。

With the help of Alex Ott I kinda solved the first problem. It was due to my horrible cedet initialisation. See his first answer for the proper way to configure CEDET!
There still remains the problem with the Idle Service Error (which, when enabling global-semantic-idle-local-symbol-highlight-mode, occurs permanently, not only when checking the definition of the type at point).
And there is the new problem of how to disable the site-wise init file(s).

EDIT2:我在缓冲区中执行了 semantic-debug-idle-function 其中出现问题,并且它产生〜700kb [sic!]输出。它看起来像是对数据容器执行一些操作,通过它的外观,它包含关于解析的文件中定义的所有符号的信息。由于我已经解析了一个相当大的包(〜20Mb源文件),这个表是相当大。可以语义处理一个数据库大,或者这是不可能的和我的问题的原因?

I have executed semantic-debug-idle-function in a buffer where the problem occurs and it produces a ~700kb [sic!] output. It looks like it is performing some operations on a data container which, by the looks of it, contains information on all the symbols defined in the files parsed. As I have parsed a rather large package (~20Mb source files) this table is rather large. Can semantic handle a database that large or is this impossible and the reason of my problem?

EDIT3:删除〜/ .semanticdb 的内容,诀窍。我仍然需要禁用site-wise init文件,但因为这与CEDET不相关我会关闭这个问题(与site-wise init文件相关的问题可以找到此处)。

Deleting the content of ~/.semanticdb and reparsing all includes did the trick. I still need to disable the site-wise init files but as this is not related to CEDET I will close this question (the question related to the site-wise init files can be found here).

推荐答案

第一个问题是通过正确配置CEDET来解决的,这是Alex Ott的首页。他的答案解决了这个第一个问题。在他的答案中指定的配置文件是一个伟大的开始一个不错的配置;我使用了相同的配置CEDET为我的需要。

The first problem was solved by correctly configuring CEDET which is discribed on Alex Ott's homepage. His answer solves this first problem. The config file specified in his answer is a great start for a nice config; I have used the very same to config CEDET for my needs.

第二个问题在我将CEDET从1.1更新到bazaar(存储库)版本后消失,这解释为这里和在Alex的文章。补充一个必须删除目录〜/ .semanticdb (其中包含语义数据库,并已损坏我猜猜)的内容。

The second problem vanished once I updated CEDET from 1.1 to the bazaar (repository) version, which is explained here and in Alex' article. Additionaly one must delete the content of the directory ~/.semanticdb (which contains the semantic database and was corrupted I guess).

我要感谢Alex Ott的帮助,并在我的整个解决方案中坚持我)。

I'd like to thank Alex Ott for his help and sticking with me throughout my journey to the solution :)

这篇关于奇怪的语义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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