How to use ctags to generate tags for glibc’s header file?

  question, vim

what i want:

In vim, you want to use the functions of omnicompletion or omnicppcompletion to realize automatic completion of glibc function, for example, enter pri in C source file, and then press C-x C-o to pop up a list to complete printf, and so on.
The problem now is that I use ctags to process the standard C header files installed by GLIBC-headers-2.15-57.FC17.I686 to generate tags_glibc files. But enter pri in the c source file, and then c-x c-o. in the pop-up menu, there is only the definition and prototype declaration of printf in stdio2.h, but there is no printf declaration of stdio.h Strangely enough, I used vim to look at the generated tags file and search printf, and found the following three entry:

printf	/usr/include/bits/stdio2.h	/^printf (__const char *__restrict __fmt, ...)$/;"	f
printf	/usr/include/bits/stdio2.h	108;"	d
printf	/usr/include/stdio.h	/^extern int printf (__const char *__restrict __format, ...);$/;"	p

The last one shows that ctags does generate the prototype declaration of printf in stdio.h (type p), but why can’t I see the third one when I enter pri<C-x C-o > in insert mode? Where did I go wrong? ?
Fprintf(stdio.h, stdio2.h all have the symbol), memcpy(string.h, string3.h all have) and other functions also have the same phenomenon.


My system is fedora17(3.6.3-1.fc17.i686), ctags is the latest version, 5.8
The ctags command used is as follows:

ctags --langmap=c:.c.h --language-force=c -h .h --c-kinds=+pxl  --exclude='tags*' --exclude='*swp' --exclude='*~' --exclude='*[!ch]' -I _THROW -I __attribute__+ -I __wur -f tags_glibc -L glibc-headers-filelist.txt 

Txt is generated by the following command:

rpm -ql glibc-headers |grep '\.h' >glibc-headers-filelist.txt


Vim experts, is there any way to generate glibc header files’ tags files better?

Include extern tags. ctags will normally ignore extern declarations of functions or variables; that’s handy when generating tags for your own programs. A tags file for the extern declarations in the system’s standard header files can be a very handy resource, so this -e flag was created.

Fromhttp://elvis.the-little-red-haired-gi …