2012-03-22 2 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 관련, 남은 단 하나의 오류가 발생, 이에 대한 자세한 내용은 다음을 참조하십시오. https://lkml.org/lkml/2012/1/12/2

관련 문제