开发者

cedet parsing issue on #ifdef

开发者 https://www.devze.com 2023-03-31 11:41 出处:网络
I \'m emacs cedet user. i got great help from cedet. but, I found some error prcessing #ifdef handling in 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 th开发者_运维知识库ere is some point I have to configure in cedet, could you give me some insight ?

thanks


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:

(setq semantic-c-obey-conditional-section-parsing-flag nil)


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:

(add-to-list 'semantic-lex-c-preprocessor-symbol-file
             "~/Software/deal.II/include/deal.II/base/config.h")

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消