対象
clang は 8.0.0 を使用。
~$ clang-8 --version
clang version 8.0.0-3~ubuntu18.04.1 (tags/RELEASE_800/final)
Target: i686-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
-CC
オプションは以下の通り。
-CC, --comments-in-macros
Include comments from within macros in preprocessed output
確認には以下の内容の test.c を使用。関数形式のマクロ aaa
の引数部分にブロックコメントがある。
test.c
#include <stdio.h>
#define aaa(/* comment */ a, b) a = b
int main(int argc, char* argv[]) {
int x = 0;
int y = 1;
aaa(x, y);
printf("x = %d\n", x);
return 0;
}
問題
-CC
オプションを使用すると以下のように "error: invalid token in macro parameter list" とエラーになる。
~$ clang-8 -E -CC -o test.txt test.c
test.c:3:13: error: invalid token in macro parameter list
#define aaa(/* comment */ a, b) a = b
^
1 error generated.
-C
オプションや通常のコンパイルでは以下のようにエラーにならない。
~$ clang-8 -E -C -o test.txt test.c
~$ clang-8 test.c
gcc でも以下のようにエラーにならない。
~$ gcc-7 -E -CC -o test.txt test.c
対処方法
わからない。
関連
以下のリンク先のように報告済みだった。