spacemacs中语法检查C语言头文件extern “C”的问题

我又来问问题了。。。

在头文件中我们常常有这样的定义,但是在我这产生了如下的问题:

#ifndef ONCE_MACRO           // warning: unterminated conditional directive
#define ONCE_MACRO

#ifdef __cplusplus           // warning: unterminated conditional directive
extern "C" {                 // warning: expected indentifier of '('
#endif                       // warning: #endif without #if

    something indent I don't want to.

#ifdef __cplusplus
}
#endif

#endif                       // warning: #endif without #if

实际上文件本身是没问题的,但是在emacs里表现如上所示,我觉得大概是3个问题:

  1. extern “C” 这里不是特别正常。
  2. #if#endif对不上了,感觉像是问题1导致的。
  3. 由于extern "C"的大括号影响了中间内容的缩进距离,我理想的状态是这种情况不产生缩进。

请问有人遇到类似的问题吗?应该从哪里着手?emacs的新手,目前还没有搞明白怎么把emacs用起来,有一点点入门无路的感觉。。。

这个问题有解吗 :joy:

clang-format 可以

C的mode不清楚,看看major-mode是啥,查查文档和emacs wiki之类的,看看能不能调整format风格

flycheck-checker 设置错了吧?

M-x flycheck-compile 然后把几个 c/c++ 相关的 checker 都试过去,应该是都不会出现这个问题的。

major-mode是c mode和c++ mode的时候都有这个问题,format的风格估计要到周末有时间看了。。。

我这里面分别有3个和c/c++相关的checker,试过都不行。。。