gpt4 book ai didi

c++ - ctags无法正确解析stdio.h

转载 作者:行者123 更新时间:2023-12-03 23:15:21 24 4
gpt4 key购买 nike

我正在尝试将Ctags与VIM一起使用,而我都是两者的新手。为了测试ctags有用的程度,我决定通过一个非常简单的测试,即解析/usr/include中的 header ,以便我可以自动完成一些非常基本的功能。

当我运行命令

 ctags  --c++-kinds=+p --fields=+iaS -f ~/.tags/tags /usr/include/*.h

然后输出打印

BUFSIZ/usr/include/stdio.h 108;“d
EOF/usr/include/stdio.h 115;“d
FILE/usr/include/stdio.h/^ typedef struct _IO_FILE FILE; $/;“t typeref:struct:_IO_FILE
FSETLOCKING_BYCALLER/usr/include/stdio_ext.h/^ FSETLOCKING_BYCALLER $/;“枚举:__ anon122
FSETLOCKING_BYCALLER/usr/include/stdio_ext.h 39;“d
FSETLOCKING_INTERNAL/usr/include/stdio_ext.h/^ FSETLOCKING_INTERNAL,$/;“e枚举:__ anon122
FSETLOCKING_INTERNAL/usr/include/stdio_ext.h 36;“d
FSETLOCKING_QUERY/usr/include/stdio_ext.h/^ FSETLOCKING_QUERY = 0,$/;“e枚举:__ anon122
FSETLOCKING_QUERY/usr/include/stdio_ext.h 32;“d
P_tmpdir/usr/include/stdio.h 128;“d
SEEK_CUR/usr/include/stdio.h 122;“d
SEEK_END/usr/include/stdio.h 123;“d
SEEK_SET/usr/include/stdio.h 121;“d
_IOFBF/usr/include/stdio.h 101;“d
_IOLBF/usr/include/stdio.h 102;“d
_IONBF/usr/include/stdio.h 103;“d
_IO_STDIO/usr/include/libio.h 165;“d
_IO_STDIO_H/usr/include/libio.h 30;“d
_OLD_STDIO_MAGIC/usr/include/libio.h 121;“d
_STDIO_EXT_H/usr/include/stdio_ext.h 24;“d
_STDIO_H/usr/include/stdio.h 27;“d
_STDIO_USES_IOSTREAM/usr/include/stdio.h 73;“d
_VA_LIST_DEFINED/usr/include/stdio.h 81;“d
__FILE/usr/include/stdio.h/^ typedef struct _IO_FILE __FILE; $/;“t typeref:struct:_IO_FILE
__FILE_defined/usr/include/stdio.h 57;“d
____FILE_defined/usr/include/stdio.h 67;“d
__need_FILE/usr/include/stdio.h 37;“d
__need_FILE/usr/include/stdio.h 59;“d
__need_NULL/usr/include/stdio.h 33;“d
__need___FILE/usr/include/stdio.h 38;“d
__need___FILE/usr/include/stdio.h 69;“d
__need_getopt/usr/include/stdio.h 902;“d
__need_size_t/usr/include/stdio.h 32;“d
__wur/usr/include/stdio.h/^ _IO_cookie_io_functions_t __io_funcs)__THROW __wur; $/;“v
__wur/usr/include/stdio.h/^ __throw __attribute__((__format__(__printf__,2,0)))__wur; $/;“v
__wur/usr/include/stdio.h/^ __throw __attribute__((__format__(__printf__,2,3)))__wur; $/;“v
__wur/usr/include/stdio.h/^ __throw __attribute_malloc__ __wur; $/;“v
__wur/usr/include/stdio.h/^ __throw __wur; $/;“v
__wur/usr/include/stdio.h/^ extern文件* fdopen(int __fd,__ const char * __ modes)__THROW __wur; $/;“v
__wur/usr/include/stdio.h/^ extern文件* open_memstream(字符** __ bufloc,size_t * __ sizeloc)__throw __wur; $/;“v
__wur/usr/include/stdio.h/^ extern char * tmpnam(char * __ s)__THROW __wur; $/;“v
__wur/usr/include/stdio.h/^ extern char * tmpnam_r(char * __ s)__THROW __wur; $/;“v
__wur/usr/include/stdio.h/^ extern int feof(FILE * __ stream)__THROW __wur; $/;“v
__wur/usr/include/stdio.h/^ extern int feof_unlocked(FILE * __ stream)__THROW __wur; $/;“v
__wur/usr/include/stdio.h/^ extern int ferror(FILE * __ stream)__THROW __wur; $/;“v
__wur/usr/include/stdio.h/^ extern int ferror_unlocked(FILE * __ stream)__THROW __wur; $/;“v
__wur/usr/include/stdio.h/^ extern int fileno(FILE * __ stream)__THROW __wur; $/;“v
__wur/usr/include/stdio.h/^ extern int fileno_unlocked(FILE * __ stream)__THROW __wur; $/;“v
__wur/usr/include/stdio.h/^ extern int ftrylockfile(FILE * __ stream)__THROW __wur; $/;“v
_flushlbf/usr/include/stdio_ext.h/^ extern void _flushlbf(void); $/;“p签名:(void)
cuserid/usr/include/stdio.h/^ extern char * cuserid(char * __ s); $/;“p签名:(char * __ s)
dprintf/usr/include/stdio.h/^ extern int dprintf(int __fd,__const char * __ restrict __fmt,...)$/;“p签名:(int __fd,__const char * __ restrict __fmt,...)
fclose/usr/include/stdio.h/^ extern int fclose(FILE * __ stream); $/;“p签名:(FILE * __ stream)
fcloseall/usr/include/stdio.h/^ extern int fcloseall(void); $/;“p签名:(void)
fflush/usr/include/stdio.h/^ extern int fflush(FILE * __ stream); $/;“p签名:(FILE * __ stream)
fflush_unlocked/usr/include/stdio.h/^ extern int fflush_unlocked(FILE * __ stream); $/;“p签名:(FILE * __ stream)
fgetc/usr/include/stdio.h/^ extern int fgetc(FILE * __ stream); $/;“p签名:(FILE * __ stream)
fgetc_unlocked/usr/include/stdio.h/^ extern int fgetc_unlocked(FILE * __ stream); $/;“p签名:(FILE * __ stream)
fgetpos/usr/include/stdio.h/^ extern int fgetpos(FILE * __ restrict __stream,fpos_t * __ restrict __pos); $/;“p签名:(FILE * __ restrict __stream,fpos_t * __ restrict __pos)
fgetpos64/usr/include/stdio.h/^ extern int fgetpos64(FILE * __ restrict __stream,fpos64_t * __ restrict __pos); $/;“p签名:(FILE * __ restrict __stream,fpos64_t * __ restrict __pos)
fpos64_t/usr/include/stdio.h/^ typedef _G_fpos64_t fpos64_t; $/;“t
fpos_t/usr/include/stdio.h/^ typedef _G_fpos_t fpos_t; $/;“t
fprintf/usr/include/stdio.h/^ extern int fprintf(FILE * __ restrict __stream,$/;“p签名:(FILE * __ restrict __stream,__const char * __ restrict __format,...)
fputc/usr/include/stdio.h/^ extern int fputc(int __c,FILE * __ stream); $/;“p签名:(int __c,FILE * __ stream)
fputc_unlocked/usr/include/stdio.h/^ extern int fputc_unlocked(int __c,FILE * __ stream); $/;“p签名:(int __c,FILE * __ stream)
fputs/usr/include/stdio.h/^ extern int fputs(__const char * __ restrict __s,FILE * __ restrict __stream); $/;“p签名:(__ const char * __ restrict __s,FILE * __ restrict __stream)
fputs_unlocked/usr/include/stdio.h/^ extern int fputs_unlocked(__const char * __ restrict __s,$/;“p签名:(__ const char * __ restrict __s,FILE * __ restrict __stream)
fscanf/usr/include/stdio.h 441;“d
fseek/usr/include/stdio.h/^ extern int fseek(FILE * __ stream,long int __off,int __whence); $/;“p签名:(FILE * __ stream,long int __off,int __whence)
fseeko/usr/include/stdio.h/^ extern int fseeko(FILE * __ stream,__off_t __off,int __whence); $/;“p签名:(FILE * __ stream,__off_t __off,int __whence)
fseeko64/usr/include/stdio.h/^ extern int fseeko64(FILE * __ stream,__off64_t __off,int __whence); $/;“p签名:(FILE * __ stream,__off64_t __off,int __whence)
fsetpos/usr/include/stdio.h/^ extern int fsetpos(FILE * __ stream,__const fpos_t * __ pos); $/;“p签名:(FILE * __ stream,__const fpos_t * __ pos)
fsetpos64/usr/include/stdio.h/^ extern int fsetpos64(FILE * __ stream,__const fpos64_t * __ pos); $/;“p签名:(FILE * __ stream,__const fpos64_t * __ pos)
getc/usr/include/stdio.h/^ extern int getc(FILE * __ stream); $/;“p签名:(FILE * __ stream)
getc/usr/include/stdio.h 527;“d
getc_unlocked/usr/include/stdio.h/^ extern int getc_unlocked(FILE * __ stream); $/;“p签名:(FILE * __ stream)
getchar/usr/include/stdio.h/^ extern int getchar(void); $/;“p签名:(void)
getchar_unlocked/usr/include/stdio.h/^ extern int getchar_unlocked(void); $/;“p签名:(void)
getw/usr/include/stdio.h/^ extern int getw(FILE * __ stream); $/;“p签名:(FILE * __ stream)
jpeg_stdio_dest/usr/include/jpeglib.h/^ EXTERN(void)jpeg_stdio_dest JPP((j_compress_ptr cinfo,FILE * outfile)); $/;“p签名:(j_compress_ptr cinfo,FILE * outfile)
jpeg_stdio_dest/usr/include/jpeglib.h 841;“d
jpeg_stdio_src/usr/include/jpeglib.h/^ EXTERN(void)jpeg_stdio_src JPP((j_decompress_ptr cinfo,FILE * infile)); $/;“p签名:(j_decompress_ptr cinfo,FILE * infile)
jpeg_stdio_src/usr/include/jpeglib.h 842;“d
pclose/usr/include/stdio.h/^ extern int pclose(FILE * __ stream); $/;“p签名:(FILE * __ stream)
perror/usr/include/stdio.h/^ extern void perror(__const char * __ s); $/;“p签名:(__ const char * __ s)
printf/usr/include/stdio.h/^ extern int printf(__const char * __ restrict __format,...); $/;“p签名:(__ const char * __ restrict __format,...)
putc/usr/include/stdio.h/^ extern int putc(int __c,FILE * __ stream); $/;“p签名:(int __c,FILE * __ stream)
putc/usr/include/stdio.h 569;“d
putc_unlocked/usr/include/stdio.h/^ extern int putc_unlocked(int __c,FILE * __ stream); $/;“p签名:(int __c,FILE * __ stream)
putchar/usr/include/stdio.h/^ extern int putchar(int __c); $/;“p签名:(int __c)
putchar_unlocked/usr/include/stdio.h/^ extern int putchar_unlocked(int __c); $/;“p签名:(int __c)
放置/usr/include/stdio.h/^ extern int放置(__const char * __ s); $/;“p签名:(__ const char * __ s)
putw/usr/include/stdio.h/^ extern int putw(int __w,FILE * __ stream); $/;“p签名:(int __w,FILE * __ stream)
倒带/usr/include/stdio.h/^ extern void倒带(FILE * __ stream); $/;“p签名:(FILE * __ stream)
scanf/usr/include/stdio.h 442;“d
sscanf/usr/include/stdio.h 443;“d
stderr/usr/include/stdio.h 152;“d
标准输入/usr/include/stdio.h 150;“d
stdout/usr/include/stdio.h 151;“d
ungetc/usr/include/stdio.h/^ extern int ungetc(int __c,FILE * __ stream); $/;“p签名:(int __c,FILE * __ stream)
va_list/usr/include/stdio.h/^ typedef _G_va_list va_list; $/;“t
vdprintf/usr/include/stdio.h/^ extern int vdprintf(int __fd,__const char * __ restrict __fmt,$/;;“p签名:(int __fd,__const char * __ restrict __fmt,_G_va_list __arg)
vfprintf/usr/include/stdio.h/^ extern int vfprintf(FILE * __ restrict __s,__const char * __ restrict __format,$/;;“p签名:(FILE * __ restrict __s,__const char * __ restrict __format,_G_va_list __arg)
vfscanf/usr/include/stdio.h 500;“d
vprintf/usr/include/stdio.h/^ extern int vprintf(__const char * __ restrict __format,_G_va_list __arg); $/;“p签名:(__ const char * __ restrict __format,_G_va_list __arg)
vscanf/usr/include/stdio.h 501;“d
vsscanf/usr/include/stdio.h 502;“d

很明显,ctags错过了一些非常明显的功能,例如fopen,但其中却包含了fclose等功能。使用ctags解析时,我是否缺少某些选项?

最佳答案

在您的ctags命令中添加一个-I__wur,您将得到想要的结果。__wur__attribute__ ((__warn_unused_result__))的宏

有关更详尽的解释,请参见:

http://sourceforge.net/mailarchive/message.php?msg_name=48A7FF60.9080609%40sina.com

关于c++ - ctags无法正确解析stdio.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1632633/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com