2012-03-22 14 views
4

私はdump the include pathsにGCCを取得しようとしましたし、私の.clang_completeファイルは今のようになります。こんにちは、単純な世界のカーネルモジュールを編集するときlinuxカーネルモジュール開発用にclang_completeを設定するにはどうすればよいですか?

-std=gnu89 
-nostdinc 
-I/usr/src/linux-headers-3.0.0-16-generic/arch/x86/include 
-I/lib/modules/3.0.0-16-generic/build/arch/x86/include/generated 
-I/lib/modules/3.0.0-16-generic/build/include 
-I/lib/modules/3.0.0-16-generic/build/ubuntu/include 
-I/usr/lib/gcc/i686-linux-gnu/4.6.1/include 
-D__KERNEL__ 
-DMODULE 

しかしlibclangはまだエラー&警告のトンを文句を言います。

1 /lib/modules/3.0.0-16-generic/build/include/linux/list.h|24 col 42 warning| declaration of 'struct list_head' will not be visible outside of this function 
2 /lib/modules/3.0.0-16-generic/build/include/linux/list.h|26 col 6 error| incomplete definition of type 'struct list_head' 
3 /lib/modules/3.0.0-16-generic/build/include/linux/list.h|24 col 42 info| forward declaration of 'struct list_head' 
4 /lib/modules/3.0.0-16-generic/build/include/linux/list.h|27 col 6 error| incomplete definition of type 'struct list_head' 
5 /lib/modules/3.0.0-16-generic/build/include/linux/list.h|24 col 42 info| forward declaration of 'struct list_head' 
6 /lib/modules/3.0.0-16-generic/build/include/linux/list.h|37 col 38 warning| declaration of 'struct list_head' will not be visible outside of this function 
... 

<linux/types.h>からstruct list_headの定義はすでに<linux/list.h>に含まれています。両方とも内部にあります/lib/modules/3.0.0-16-generic/build/include

答えて

4

clang_completeにバンドルされているcc_args.pyはあなたにとって有用でした。有効な.clang_completeファイルを作成する必要があります。残念ながら(私はちょうどそれをテストした、私はそれを修正しようとする)、ここで動作しません(.clang_completeファイルを作成できませんでした)。

がしかし、スクリプトとその結果を微調整することで、私は有効な.clang_completeファイルを生成することができました:この.clang_completeで

-D__KERNEL__ 
-DCONFIG_AS_CFI=1 
-DCONFIG_AS_CFI_SIGNAL_FRAME=1 
-DCONFIG_AS_CFI_SECTIONS=1 
-DCONFIG_AS_FXSAVEQ=1 
-nostdinc 
-I/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include 
-I/usr/src/linux-3.2.12-1-ARCH/arch/x86/include 
-I/usr/src/linux-3.2.12-1-ARCH/arch/x86/include/generated 
-I/usr/src/linux-3.2.12-1-ARCH/include 
-DMODULE 
-DKBUILD_STR(s)=#s 
-include /usr/src/linux-3.2.12-1-ARCH/include/linux/kconfig.h 

を、__kfree_rcuに関連し、1つしか残ってエラーがあります、詳細については、https://lkml.org/lkml/2012/1/12/2

を参照してください。
関連する問題