[cfe-dev] Can clang parse the Linux kernel?

Douglas Gregor dgregor at apple.com
Fri Dec 19 13:19:29 PST 2008


On Dec 19, 2008, at 10:10 PM, Roberto Bagnara wrote:
> Trying to answer this question, I had a go at Linux 2.6.27.10.
> I did not go very far, as make stopped because of the following:
>
> $ clang -w modpost.i
> modpost.i:6067:28: error: used type '_Elf64_Mips_R_Info_union' where  
> arithmetic or pointer type is required
>    r_sym = ((__extension__ (_Elf64_Mips_R_Info_union)(rela- 
> >r_info)).r_info_fields.r_sym);
>                            ^                         ~~~~~~~~~~~~~~
> modpost.i:6069:28: error: used type '_Elf64_Mips_R_Info_union' where  
> arithmetic or pointer type is required
>    r_typ = ((__extension__ (_Elf64_Mips_R_Info_union)(rela- 
> >r_info)).r_info_fields.r_type1);
>                            ^                         ~~~~~~~~~~~~~~
> modpost.i:6111:28: error: used type '_Elf64_Mips_R_Info_union' where  
> arithmetic or pointer type is required
>    r_sym = ((__extension__ (_Elf64_Mips_R_Info_union)(rel- 
> >r_info)).r_info_fields.r_sym);
>                            ^                         ~~~~~~~~~~~~~
> modpost.i:6113:28: error: used type '_Elf64_Mips_R_Info_union' where  
> arithmetic or pointer type is required
>    r_typ = ((__extension__ (_Elf64_Mips_R_Info_union)(rel- 
> >r_info)).r_info_fields.r_type1);
>                            ^                         ~~~~~~~~~~~~~
> 4 diagnostics generated.
> $
>
> Should I file bug reports for such problems?

Yes, please. We aim to eventually support most of GCC's extensions. In  
this case, we haven't implemented a cast to union type:

	http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Cast-to-Union.html#Cast-to-Union

	- Doug



More information about the cfe-dev mailing list