Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

company-clang doesn't work with kernel 5.3.6 #60

Open
choyoungcin opened this issue Oct 27, 2019 · 0 comments
Open

company-clang doesn't work with kernel 5.3.6 #60

choyoungcin opened this issue Oct 27, 2019 · 0 comments

Comments

@choyoungcin
Copy link

Hi tuhdo,
I follow your blog and want to build an ide environment for kernel code reading.
When I try complete-mode with clang, something seems go wrong.
For example, when i type in

struct devi

then type command M-x company-complete, I wish struct device be auto-completed or a completion menu popped up, but i get the hint No completion found in the echo erea.

I got the following errors from clang-error buffer:

clang failed with error 1:
/usr/bin/clang -fsyntax-only -Xclang -code-completion-macros -x c -I/home/gnu/linux-5.3.6/include/ -I/home/gnu/linux-5.3.6/arch/arm/include/ -Xclang -code-completion-at=-:95:26 -

In file included from :7:
In file included from /home/gnu/linux-5.3.6/include/linux/kernel.h:13:
/home/gnu/linux-5.3.6/include/linux/log2.h:197:15: error: unknown type name 'attribute_const'
static inline attribute_const
^
/home/gnu/linux-5.3.6/include/linux/log2.h:198:1: error: expected identifier or '('
int __order_base_2(unsigned long n)
^
In file included from :7:
In file included from /home/gnu/linux-5.3.6/include/linux/kernel.h:15:
In file included from /home/gnu/linux-5.3.6/include/linux/printk.h:6:
/home/gnu/linux-5.3.6/include/linux/init.h:144:13: error: expected parameter declarator
extern char __initdata boot_command_line[];
^
/home/gnu/linux-5.3.6/include/linux/init.h:51:30: note: expanded from macro '__initdata'
#define __initdata __section(.init.data)
....
/home/gnu/linux-5.3.6/arch/arm/include/uapi/asm/swab.h:28:8: error: 'inline' can only appear on functions
static inline attribute_const __u32 __arch_swab32(__u32 x)
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

My emacs version: 26.1
& clang version: 7.0.1-9+b1 (tags/RELEASE_701/final)

Below is the content of variable company-clang-arguments

company-clang-arguments is a variable defined in ‘company-clang.el’.
Its value is
("-I/home/gnu/linux-5.3.6/include/" "-I/home/gnu/linux-5.3.6/arch/arm/include/")
Original value was nil
Local in buffer Makefile; global value is nil

This variable’s value is directory-local, set by the file
‘/home/gnu/linux-5.3.6/.dir-locals.el’.

Documentation:
Additional arguments to pass to clang when completing.
Prefix files (-include ...) can be selected with ‘company-clang-set-prefix’
or automatically through a custom ‘company-clang-prefix-guesser’.

You can customize this variable.

Any suggestion or help?
Many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant