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

Ctags include files #4035

Open
navinp0304 opened this issue Jul 25, 2024 · 2 comments
Open

Ctags include files #4035

navinp0304 opened this issue Jul 25, 2024 · 2 comments

Comments

@navinp0304
Copy link

#include "/usr/local/include/test.h"
This is present in one of my source files in /projects

Will ctags go to the include path and get the definition of struct or functions inside it ?

What options to use to recursively include.h inside test.h ?

@masatake
Copy link
Member

NO.

However, I have wanted to implement such a feature for years. -r (and --semantic-recurse, or -S) options are reserved.

See #2428

@masatake
Copy link
Member

It's inefficient but works.

[yamato@dev64 ctags-github]$ cat foo.c
cat foo.c
#include <string.h>

int main(void) { return 0; }
[yamato@dev64 ctags-github]$ bash ./srec-ctags -o - foo.c
bash ./srec-ctags -o - foo.c
_ATFILE_SOURCE	/usr/include/features.h	/^# define _ATFILE_SOURCE	/;"	d
_BITS_STRING_FORTIFIED_H	/usr/include/bits/string_fortified.h	/^#define _BITS_STRING_FORTIFIED_H /;"	d
_BITS_TYPES_LOCALE_T_H	/usr/include/bits/types/locale_t.h	/^#define _BITS_TYPES_LOCALE_T_H /;"	d
_BITS_TYPES___LOCALE_T_H	/usr/include/bits/types/__locale_t.h	/^#define _BITS_TYPES___LOCALE_T_H /;"	d
_DEFAULT_SOURCE	/usr/include/features.h	/^# define _DEFAULT_SOURCE	/;"	d
_DYNAMIC_STACK_SIZE_SOURCE	/usr/include/features.h	/^# define _DYNAMIC_STACK_SIZE_SOURCE /;"	d
_FEATURES_H	/usr/include/features.h	/^#define	_FEATURES_H	/;"	d
_ISOC11_SOURCE	/usr/include/features.h	/^# define _ISOC11_SOURCE	/;"	d
_ISOC2X_SOURCE	/usr/include/features.h	/^# define _ISOC2X_SOURCE	/;"	d
_ISOC95_SOURCE	/usr/include/features.h	/^# define _ISOC95_SOURCE	/;"	d
_ISOC99_SOURCE	/usr/include/features.h	/^# define _ISOC99_SOURCE	/;"	d
_LARGEFILE64_SOURCE	/usr/include/features.h	/^# define _LARGEFILE64_SOURCE	/;"	d
_LARGEFILE_SOURCE	/usr/include/features.h	/^#  define _LARGEFILE_SOURCE	/;"	d
_Noreturn	/usr/include/sys/cdefs.h	/^#  define _Noreturn /;"	d
_Noreturn	/usr/include/sys/cdefs.h	/^#  define _Noreturn$/;"	d
_POSIX_C_SOURCE	/usr/include/features.h	/^#  define _POSIX_C_SOURCE	/;"	d
_POSIX_C_SOURCE	/usr/include/features.h	/^# define _POSIX_C_SOURCE	/;"	d
_POSIX_C_SOURCE	/usr/include/features.h	/^# define _POSIX_C_SOURCE /;"	d
_POSIX_SOURCE	/usr/include/features.h	/^# define _POSIX_SOURCE	/;"	d
_POSIX_SOURCE	/usr/include/features.h	/^# define _POSIX_SOURCE /;"	d
_STDC_PREDEF_H	/usr/include/stdc-predef.h	/^#define	_STDC_PREDEF_H	/;"	d
_STRINGS_H	/usr/include/strings.h	/^#define	_STRINGS_H	/;"	d
_STRING_H	/usr/include/string.h	/^#define	_STRING_H	/;"	d
_SYS_CDEFS_H	/usr/include/sys/cdefs.h	/^#define	_SYS_CDEFS_H	/;"	d
_Static_assert	/usr/include/sys/cdefs.h	/^# define _Static_assert(/;"	d
_XOPEN_SOURCE	/usr/include/features.h	/^# define _XOPEN_SOURCE	/;"	d
_XOPEN_SOURCE_EXTENDED	/usr/include/features.h	/^# define _XOPEN_SOURCE_EXTENDED	/;"	d
__ASMNAME	/usr/include/sys/cdefs.h	/^# define __ASMNAME(cname)  __ASMNAME2/;"	d
__ASMNAME2	/usr/include/sys/cdefs.h	/^# define __ASMNAME2(/;"	d
__BEGIN_DECLS	/usr/include/sys/cdefs.h	/^# define __BEGIN_DECLS	/;"	d
__BEGIN_DECLS	/usr/include/sys/cdefs.h	/^# define __BEGIN_DECLS$/;"	d
__COLD	/usr/include/sys/cdefs.h	/^#  define __COLD	/;"	d
__COLD	/usr/include/sys/cdefs.h	/^#  define __COLD$/;"	d
__COLD	/usr/include/sys/cdefs.h	/^# define __COLD$/;"	d
__CONCAT	/usr/include/sys/cdefs.h	/^#define __CONCAT(/;"	d
__CORRECT_ISO_CPP_STRINGS_H_PROTO	/usr/include/strings.h	/^# define __CORRECT_ISO_CPP_STRINGS_H_PROTO$/;"	d
__CORRECT_ISO_CPP_STRING_H_PROTO	/usr/include/string.h	/^# define __CORRECT_ISO_CPP_STRING_H_PROTO$/;"	d
__END_DECLS	/usr/include/sys/cdefs.h	/^# define __END_DECLS	/;"	d
__END_DECLS	/usr/include/sys/cdefs.h	/^# define __END_DECLS$/;"	d
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION	/usr/include/string.h	/^#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION$/;"	d
__GLIBC_MINOR__	/usr/include/features.h	/^#define	__GLIBC_MINOR__	/;"	d
__GLIBC_PREREQ	/usr/include/features.h	/^#define __GLIBC_PREREQ(/;"	d
__GLIBC_USE	/usr/include/features.h	/^#define __GLIBC_USE(F)	__GLIBC_USE_/;"	d
__GLIBC_USE_C2X_STRTOL	/usr/include/features.h	/^# define __GLIBC_USE_C2X_STRTOL /;"	d
__GLIBC_USE_DEPRECATED_GETS	/usr/include/features.h	/^# define __GLIBC_USE_DEPRECATED_GETS /;"	d
__GLIBC_USE_DEPRECATED_SCANF	/usr/include/features.h	/^# define __GLIBC_USE_DEPRECATED_SCANF /;"	d
__GLIBC_USE_IEC_60559_BFP_EXT	/usr/include/bits/libc-header-start.h	/^# define __GLIBC_USE_IEC_60559_BFP_EXT /;"	d
__GLIBC_USE_IEC_60559_BFP_EXT_C2X	/usr/include/bits/libc-header-start.h	/^# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X /;"	d
__GLIBC_USE_IEC_60559_EXT	/usr/include/bits/libc-header-start.h	/^# define __GLIBC_USE_IEC_60559_EXT /;"	d
__GLIBC_USE_IEC_60559_FUNCS_EXT	/usr/include/bits/libc-header-start.h	/^# define __GLIBC_USE_IEC_60559_FUNCS_EXT /;"	d
__GLIBC_USE_IEC_60559_FUNCS_EXT_C2X	/usr/include/bits/libc-header-start.h	/^# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X /;"	d
__GLIBC_USE_IEC_60559_TYPES_EXT	/usr/include/bits/libc-header-start.h	/^# define __GLIBC_USE_IEC_60559_TYPES_EXT /;"	d
__GLIBC_USE_ISOC2X	/usr/include/features.h	/^# define __GLIBC_USE_ISOC2X	/;"	d
__GLIBC_USE_LIB_EXT2	/usr/include/bits/libc-header-start.h	/^# define __GLIBC_USE_LIB_EXT2 /;"	d
__GLIBC__	/usr/include/features.h	/^#define	__GLIBC__	/;"	d
__GNUC_PREREQ	/usr/include/features.h	/^# define __GNUC_PREREQ(/;"	d
__GNU_LIBRARY__	/usr/include/features.h	/^#define __GNU_LIBRARY__ /;"	d
__HAVE_GENERIC_SELECTION	/usr/include/sys/cdefs.h	/^# define __HAVE_GENERIC_SELECTION /;"	d
__KERNEL_STRICT_NAMES	/usr/include/features.h	/^# define __KERNEL_STRICT_NAMES$/;"	d
__LDBL_COMPAT	/usr/include/sys/cdefs.h	/^# define __LDBL_COMPAT /;"	d
__LDBL_REDIR	/usr/include/sys/cdefs.h	/^#  define __LDBL_REDIR(/;"	d
__LDBL_REDIR	/usr/include/sys/cdefs.h	/^# define __LDBL_REDIR(/;"	d
__LDBL_REDIR1	/usr/include/sys/cdefs.h	/^#  define __LDBL_REDIR1(/;"	d
__LDBL_REDIR1	/usr/include/sys/cdefs.h	/^# define __LDBL_REDIR1(/;"	d
__LDBL_REDIR1_DECL	/usr/include/sys/cdefs.h	/^#  define __LDBL_REDIR1_DECL(/;"	d
__LDBL_REDIR1_NTH	/usr/include/sys/cdefs.h	/^#  define __LDBL_REDIR1_NTH(/;"	d
__LDBL_REDIR1_NTH	/usr/include/sys/cdefs.h	/^# define __LDBL_REDIR1_NTH(/;"	d
__LDBL_REDIR2_DECL	/usr/include/sys/cdefs.h	/^#  define __LDBL_REDIR2_DECL(/;"	d
__LDBL_REDIR2_DECL	/usr/include/sys/cdefs.h	/^# define __LDBL_REDIR2_DECL(/;"	d
__LDBL_REDIR_DECL	/usr/include/sys/cdefs.h	/^#  define __LDBL_REDIR_DECL(/;"	d
__LDBL_REDIR_DECL	/usr/include/sys/cdefs.h	/^# define __LDBL_REDIR_DECL(/;"	d
__LDBL_REDIR_NTH	/usr/include/sys/cdefs.h	/^#  define __LDBL_REDIR_NTH(/;"	d
__LDBL_REDIR_NTH	/usr/include/sys/cdefs.h	/^# define __LDBL_REDIR_NTH(/;"	d
__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI	/usr/include/bits/long-double.h	/^#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI /;"	d
__LEAF	/usr/include/sys/cdefs.h	/^#  define __LEAF /;"	d
__LEAF	/usr/include/sys/cdefs.h	/^#  define __LEAF$/;"	d
__LEAF_ATTR	/usr/include/sys/cdefs.h	/^#  define __LEAF_ATTR /;"	d
__LEAF_ATTR	/usr/include/sys/cdefs.h	/^#  define __LEAF_ATTR$/;"	d
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (explicit_bzero (void *__dest, size_t __len))$/;"	f	typeref:typename:__fortify_function void
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (memcpy (void *__restrict __dest, const void *__restrict __src,$/;"	f	typeref:typename:__fortify_function void *
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (memmove (void *__dest, const void *__src, size_t __len))$/;"	f	typeref:typename:__fortify_function void *
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (mempcpy (void *__restrict __dest, const void *__restrict __src,$/;"	f	typeref:typename:__fortify_function void *
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (memset (void *__dest, int __ch, size_t __len))$/;"	f	typeref:typename:__fortify_function void *
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (stpcpy (char *__restrict __dest, const char *__restrict __src))$/;"	f	typeref:typename:__fortify_function char *
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (stpncpy (char *__dest, const char *__src, size_t __n))$/;"	f	typeref:typename:__fortify_function char *
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (strcat (char *__restrict __dest, const char *__restrict __src))$/;"	f	typeref:typename:__fortify_function char *
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (strcpy (char *__restrict __dest, const char *__restrict __src))$/;"	f	typeref:typename:__fortify_function char *
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (strlcat (char *__restrict __dest, const char *__restrict __src,$/;"	f	typeref:typename:__fortify_function size_t
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (strlcpy (char *__restrict __dest, const char *__restrict __src,$/;"	f	typeref:typename:__fortify_function size_t
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (strncat (char *__restrict __dest, const char *__restrict __src,$/;"	f	typeref:typename:__fortify_function char *
__NTH	/usr/include/bits/string_fortified.h	/^__NTH (strncpy (char *__restrict __dest, const char *__restrict __src,$/;"	f	typeref:typename:__fortify_function char *
__NTH	/usr/include/bits/strings_fortified.h	/^__NTH (bcopy (const void *__src, void *__dest, size_t __len))$/;"	f	typeref:typename:__fortify_function void
__NTH	/usr/include/bits/strings_fortified.h	/^__NTH (bzero (void *__dest, size_t __len))$/;"	f	typeref:typename:__fortify_function void
__NTH	/usr/include/sys/cdefs.h	/^#   define __NTH(/;"	d
__NTH	/usr/include/sys/cdefs.h	/^#  define __NTH(/;"	d
__NTH	/usr/include/sys/cdefs.h	/^# define __NTH(/;"	d
__NTHNL	/usr/include/sys/cdefs.h	/^#   define __NTHNL(/;"	d
__NTHNL	/usr/include/sys/cdefs.h	/^#  define __NTHNL(/;"	d
__P	/usr/include/sys/cdefs.h	/^#define __P(/;"	d
__PMT	/usr/include/sys/cdefs.h	/^#define __PMT(/;"	d
__REDIRECT	/usr/include/sys/cdefs.h	/^# define __REDIRECT(/;"	d
__REDIRECT_FORTIFY	/usr/include/sys/cdefs.h	/^#define __REDIRECT_FORTIFY /;"	d
__REDIRECT_FORTIFY_NTH	/usr/include/sys/cdefs.h	/^#define __REDIRECT_FORTIFY_NTH /;"	d
__REDIRECT_LDBL	/usr/include/sys/cdefs.h	/^#  define __REDIRECT_LDBL(/;"	d
__REDIRECT_NTH	/usr/include/sys/cdefs.h	/^#  define __REDIRECT_NTH(/;"	d
__REDIRECT_NTHNL	/usr/include/sys/cdefs.h	/^#  define __REDIRECT_NTHNL(/;"	d
__REDIRECT_NTH_LDBL	/usr/include/sys/cdefs.h	/^#  define __REDIRECT_NTH_LDBL(/;"	d
__STDC_IEC_559_COMPLEX__	/usr/include/stdc-predef.h	/^#  define __STDC_IEC_559_COMPLEX__	/;"	d
__STDC_IEC_559_COMPLEX__	/usr/include/stdc-predef.h	/^# define __STDC_IEC_559_COMPLEX__	/;"	d
__STDC_IEC_559__	/usr/include/stdc-predef.h	/^#  define __STDC_IEC_559__	/;"	d
__STDC_IEC_559__	/usr/include/stdc-predef.h	/^# define __STDC_IEC_559__	/;"	d
__STDC_IEC_60559_BFP__	/usr/include/stdc-predef.h	/^#  define __STDC_IEC_60559_BFP__ /;"	d
__STDC_IEC_60559_BFP__	/usr/include/stdc-predef.h	/^# define __STDC_IEC_60559_BFP__ /;"	d
__STDC_IEC_60559_COMPLEX__	/usr/include/stdc-predef.h	/^#  define __STDC_IEC_60559_COMPLEX__	/;"	d
__STDC_IEC_60559_COMPLEX__	/usr/include/stdc-predef.h	/^# define __STDC_IEC_60559_COMPLEX__	/;"	d
__STDC_ISO_10646__	/usr/include/stdc-predef.h	/^#define __STDC_ISO_10646__	/;"	d
__STRING	/usr/include/sys/cdefs.h	/^#define __STRING(/;"	d
__STRINGS_FORTIFIED	/usr/include/bits/strings_fortified.h	/^# define __STRINGS_FORTIFIED /;"	d
__SYSCALL_WORDSIZE	/usr/include/bits/wordsize.h	/^# define __SYSCALL_WORDSIZE	/;"	d
__THROW	/usr/include/sys/cdefs.h	/^#    define __THROW	/;"	d
__THROW	/usr/include/sys/cdefs.h	/^#   define __THROW$/;"	d
__THROW	/usr/include/sys/cdefs.h	/^#  define __THROW	/;"	d
__THROW	/usr/include/sys/cdefs.h	/^# define __THROW$/;"	d
__THROWNL	/usr/include/sys/cdefs.h	/^#   define __THROWNL	/;"	d
__THROWNL	/usr/include/sys/cdefs.h	/^#   define __THROWNL$/;"	d
__THROWNL	/usr/include/sys/cdefs.h	/^#  define __THROWNL	/;"	d
__THROWNL	/usr/include/sys/cdefs.h	/^# define __THROWNL$/;"	d
__TIMESIZE	/usr/include/bits/timesize.h	/^# define __TIMESIZE	/;"	d
__USE_ATFILE	/usr/include/features.h	/^# define __USE_ATFILE	/;"	d
__USE_DYNAMIC_STACK_SIZE	/usr/include/features.h	/^# define __USE_DYNAMIC_STACK_SIZE	/;"	d
__USE_EXTERN_INLINES	/usr/include/features.h	/^# define __USE_EXTERN_INLINES	/;"	d
__USE_FILE_OFFSET64	/usr/include/features.h	/^# define __USE_FILE_OFFSET64	/;"	d
__USE_FORTIFY_LEVEL	/usr/include/features.h	/^#  define __USE_FORTIFY_LEVEL /;"	d
__USE_FORTIFY_LEVEL	/usr/include/features.h	/^# define __USE_FORTIFY_LEVEL /;"	d
__USE_GNU	/usr/include/features.h	/^# define __USE_GNU	/;"	d
__USE_ISOC11	/usr/include/features.h	/^#  define __USE_ISOC11	/;"	d
__USE_ISOC11	/usr/include/features.h	/^# define __USE_ISOC11	/;"	d
__USE_ISOC95	/usr/include/features.h	/^#   define __USE_ISOC95	/;"	d
__USE_ISOC95	/usr/include/features.h	/^# define __USE_ISOC95	/;"	d
__USE_ISOC99	/usr/include/features.h	/^#   define __USE_ISOC99	/;"	d
__USE_ISOC99	/usr/include/features.h	/^#  define __USE_ISOC99	/;"	d
__USE_ISOC99	/usr/include/features.h	/^# define __USE_ISOC99	/;"	d
__USE_ISOCXX11	/usr/include/features.h	/^#  define __USE_ISOCXX11	/;"	d
__USE_LARGEFILE	/usr/include/features.h	/^#  define __USE_LARGEFILE	/;"	d
__USE_LARGEFILE	/usr/include/features.h	/^# define __USE_LARGEFILE	/;"	d
__USE_LARGEFILE64	/usr/include/features.h	/^#  define __USE_LARGEFILE64	/;"	d
__USE_LARGEFILE64	/usr/include/features.h	/^# define __USE_LARGEFILE64	/;"	d
__USE_MISC	/usr/include/features.h	/^# define __USE_MISC	/;"	d
__USE_POSIX	/usr/include/features.h	/^# define __USE_POSIX	/;"	d
__USE_POSIX199309	/usr/include/features.h	/^# define __USE_POSIX199309	/;"	d
__USE_POSIX199506	/usr/include/features.h	/^# define __USE_POSIX199506	/;"	d
__USE_POSIX2	/usr/include/features.h	/^# define __USE_POSIX2	/;"	d
__USE_POSIX_IMPLICITLY	/usr/include/features.h	/^#  define __USE_POSIX_IMPLICITLY	/;"	d
__USE_POSIX_IMPLICITLY	/usr/include/features.h	/^# define __USE_POSIX_IMPLICITLY	/;"	d
__USE_TIME64_REDIRECTS	/usr/include/features-time64.h	/^# define __USE_TIME64_REDIRECTS /;"	d
__USE_TIME_BITS64	/usr/include/features-time64.h	/^#  define __USE_TIME_BITS64	/;"	d
__USE_TIME_BITS64	/usr/include/features-time64.h	/^# define __USE_TIME_BITS64 /;"	d
__USE_UNIX98	/usr/include/features.h	/^#  define __USE_UNIX98	/;"	d
__USE_XOPEN	/usr/include/features.h	/^# define __USE_XOPEN	/;"	d
__USE_XOPEN2K	/usr/include/features.h	/^#   define __USE_XOPEN2K	/;"	d
__USE_XOPEN2K	/usr/include/features.h	/^# define __USE_XOPEN2K	/;"	d
__USE_XOPEN2K8	/usr/include/features.h	/^#    define __USE_XOPEN2K8	/;"	d
__USE_XOPEN2K8	/usr/include/features.h	/^# define __USE_XOPEN2K8	/;"	d
__USE_XOPEN2K8XSI	/usr/include/features.h	/^#    define __USE_XOPEN2K8XSI	/;"	d
__USE_XOPEN2KXSI	/usr/include/features.h	/^#   define __USE_XOPEN2KXSI	/;"	d
__USE_XOPEN_EXTENDED	/usr/include/features.h	/^#   define __USE_XOPEN_EXTENDED	/;"	d
__USE_XOPEN_EXTENDED	/usr/include/features.h	/^#  define __USE_XOPEN_EXTENDED	/;"	d
__WORDSIZE	/usr/include/bits/wordsize.h	/^# define __WORDSIZE	/;"	d
__WORDSIZE32_PTRDIFF_LONG	/usr/include/bits/wordsize.h	/^#define __WORDSIZE32_PTRDIFF_LONG	/;"	d
__WORDSIZE32_SIZE_ULONG	/usr/include/bits/wordsize.h	/^#define __WORDSIZE32_SIZE_ULONG	/;"	d
__WORDSIZE_TIME64_COMPAT32	/usr/include/bits/wordsize.h	/^#define __WORDSIZE_TIME64_COMPAT32 /;"	d
__always_inline	/usr/include/sys/cdefs.h	/^# define __always_inline /;"	d
__always_inline	/usr/include/sys/cdefs.h	/^# define __always_inline __inline __attribute__ ((__always_inline_/;"	d
__attr_access	/usr/include/sys/cdefs.h	/^#  define __attr_access(/;"	d
__attr_access_none	/usr/include/sys/cdefs.h	/^#    define __attr_access_none(/;"	d
__attr_access_none	/usr/include/sys/cdefs.h	/^#  define __attr_access_none(/;"	d
__attr_dealloc	/usr/include/sys/cdefs.h	/^# define __attr_dealloc(/;"	d
__attr_dealloc_free	/usr/include/sys/cdefs.h	/^# define __attr_dealloc_free /;"	d
__attr_dealloc_free	/usr/include/sys/cdefs.h	/^# define __attr_dealloc_free$/;"	d
__attribute__	/usr/include/sys/cdefs.h	/^# define __attribute__(/;"	d
__attribute_alloc_align__	/usr/include/sys/cdefs.h	/^# define __attribute_alloc_align__(/;"	d
__attribute_alloc_size__	/usr/include/sys/cdefs.h	/^# define __attribute_alloc_size__(/;"	d
__attribute_artificial__	/usr/include/sys/cdefs.h	/^# define __attribute_artificial__ /;"	d
__attribute_const__	/usr/include/sys/cdefs.h	/^# define __attribute_const__ /;"	d
__attribute_copy__	/usr/include/sys/cdefs.h	/^# define __attribute_copy__(/;"	d
__attribute_deprecated__	/usr/include/sys/cdefs.h	/^# define __attribute_deprecated__ /;"	d
__attribute_deprecated_msg__	/usr/include/sys/cdefs.h	/^# define __attribute_deprecated_msg__(/;"	d
__attribute_format_arg__	/usr/include/sys/cdefs.h	/^# define __attribute_format_arg__(/;"	d
__attribute_format_strfmon__	/usr/include/sys/cdefs.h	/^# define __attribute_format_strfmon__(/;"	d
__attribute_malloc__	/usr/include/sys/cdefs.h	/^# define __attribute_malloc__ /;"	d
__attribute_maybe_unused__	/usr/include/sys/cdefs.h	/^# define __attribute_maybe_unused__ /;"	d
__attribute_noinline__	/usr/include/sys/cdefs.h	/^# define __attribute_noinline__ /;"	d
__attribute_nonnull__	/usr/include/sys/cdefs.h	/^#  define __attribute_nonnull__(/;"	d
__attribute_nonstring__	/usr/include/sys/cdefs.h	/^# define __attribute_nonstring__ /;"	d
__attribute_nonstring__	/usr/include/sys/cdefs.h	/^# define __attribute_nonstring__$/;"	d
__attribute_pure__	/usr/include/sys/cdefs.h	/^# define __attribute_pure__ /;"	d
__attribute_returns_twice__	/usr/include/sys/cdefs.h	/^# define __attribute_returns_twice__ /;"	d
__attribute_struct_may_alias__	/usr/include/sys/cdefs.h	/^# define __attribute_struct_may_alias__ /;"	d
__attribute_struct_may_alias__	/usr/include/sys/cdefs.h	/^# define __attribute_struct_may_alias__$/;"	d
__attribute_used__	/usr/include/sys/cdefs.h	/^# define __attribute_used__ /;"	d
__attribute_warn_unused_result__	/usr/include/sys/cdefs.h	/^# define __attribute_warn_unused_result__ /;"	d
__bos	/usr/include/sys/cdefs.h	/^#define __bos(/;"	d
__bos0	/usr/include/sys/cdefs.h	/^#define __bos0(/;"	d
__ctype_b	/usr/include/bits/types/__locale_t.h	/^  const unsigned short int *__ctype_b;$/;"	m	struct:__locale_struct	typeref:typename:const unsigned short int *
__ctype_tolower	/usr/include/bits/types/__locale_t.h	/^  const int *__ctype_tolower;$/;"	m	struct:__locale_struct	typeref:typename:const int *
__ctype_toupper	/usr/include/bits/types/__locale_t.h	/^  const int *__ctype_toupper;$/;"	m	struct:__locale_struct	typeref:typename:const int *
__errordecl	/usr/include/sys/cdefs.h	/^# define __errordecl(/;"	d
__extension__	/usr/include/sys/cdefs.h	/^# define __extension__	/;"	d
__extern_always_inline	/usr/include/sys/cdefs.h	/^#  define __extern_always_inline /;"	d
__extern_inline	/usr/include/sys/cdefs.h	/^#  define __extern_inline /;"	d
__flexarr	/usr/include/sys/cdefs.h	/^# define __flexarr	/;"	d
__fortified_attr_access	/usr/include/sys/cdefs.h	/^#    define __fortified_attr_access(/;"	d
__fortified_attr_access	/usr/include/sys/cdefs.h	/^#  define __fortified_attr_access(/;"	d
__fortify_function	/usr/include/sys/cdefs.h	/^# define __fortify_function /;"	d
__glibc_c99_flexarr_available	/usr/include/sys/cdefs.h	/^# define __glibc_c99_flexarr_available /;"	d
__glibc_clang_prereq	/usr/include/features.h	/^# define __glibc_clang_prereq(/;"	d
__glibc_fortify	/usr/include/sys/cdefs.h	/^#define __glibc_fortify(/;"	d
__glibc_fortify_n	/usr/include/sys/cdefs.h	/^#define __glibc_fortify_n(/;"	d
__glibc_has_attribute	/usr/include/sys/cdefs.h	/^# define __glibc_has_attribute(/;"	d
__glibc_has_builtin	/usr/include/sys/cdefs.h	/^# define __glibc_has_builtin(/;"	d
__glibc_has_extension	/usr/include/sys/cdefs.h	/^# define __glibc_has_extension(/;"	d
__glibc_likely	/usr/include/sys/cdefs.h	/^# define __glibc_likely(/;"	d
__glibc_macro_warning	/usr/include/sys/cdefs.h	/^# define __glibc_macro_warning(/;"	d
__glibc_macro_warning1	/usr/include/sys/cdefs.h	/^# define __glibc_macro_warning1(/;"	d
__glibc_objsize	/usr/include/sys/cdefs.h	/^# define __glibc_objsize(/;"	d
__glibc_objsize0	/usr/include/sys/cdefs.h	/^# define __glibc_objsize0(/;"	d
__glibc_safe_len_cond	/usr/include/sys/cdefs.h	/^#define __glibc_safe_len_cond(/;"	d
__glibc_safe_or_unknown_len	/usr/include/sys/cdefs.h	/^#define __glibc_safe_or_unknown_len(/;"	d
__glibc_unlikely	/usr/include/sys/cdefs.h	/^# define __glibc_unlikely(/;"	d
__glibc_unsafe_len	/usr/include/sys/cdefs.h	/^#define __glibc_unsafe_len(/;"	d
__glibc_unsigned_or_positive	/usr/include/sys/cdefs.h	/^#define __glibc_unsigned_or_positive(/;"	d
__inline	/usr/include/sys/cdefs.h	/^#  define __inline	/;"	d
__locale_struct	/usr/include/bits/types/__locale_t.h	/^struct __locale_struct$/;"	s
__locale_t	/usr/include/bits/types/__locale_t.h	/^typedef struct __locale_struct *__locale_t;$/;"	t	typeref:struct:__locale_struct *
__locales	/usr/include/bits/types/__locale_t.h	/^  struct __locale_data *__locales[13]; \/* 13 = __LC_LAST. *\/$/;"	m	struct:__locale_struct	typeref:struct:__locale_data * [13]
__names	/usr/include/bits/types/__locale_t.h	/^  const char *__names[13];$/;"	m	struct:__locale_struct	typeref:typename:const char * [13]
__need_NULL	/usr/include/string.h	/^#define	__need_NULL$/;"	d
__need_size_t	/usr/include/string.h	/^#define	__need_size_t$/;"	d
__need_size_t	/usr/include/strings.h	/^#define __need_size_t$/;"	d
__nonnull	/usr/include/sys/cdefs.h	/^# define __nonnull(/;"	d
__ptr_t	/usr/include/sys/cdefs.h	/^#define __ptr_t /;"	d
__restrict	/usr/include/sys/cdefs.h	/^#  define __restrict	/;"	d
__restrict_arr	/usr/include/sys/cdefs.h	/^#   define __restrict_arr	/;"	d
__restrict_arr	/usr/include/sys/cdefs.h	/^#  define __restrict_arr	/;"	d
__restrict_arr	/usr/include/sys/cdefs.h	/^# define __restrict_arr	/;"	d
__returns_nonnull	/usr/include/sys/cdefs.h	/^# define __returns_nonnull __attribute__ ((__returns_nonnull_/;"	d
__returns_nonnull	/usr/include/sys/cdefs.h	/^# define __returns_nonnull$/;"	d
__stub___compat_bdflush	/usr/include/gnu/stubs-64.h	/^#define __stub___compat_bdflush$/;"	d
__stub_chflags	/usr/include/gnu/stubs-64.h	/^#define __stub_chflags$/;"	d
__stub_fchflags	/usr/include/gnu/stubs-64.h	/^#define __stub_fchflags$/;"	d
__stub_gtty	/usr/include/gnu/stubs-64.h	/^#define __stub_gtty$/;"	d
__stub_revoke	/usr/include/gnu/stubs-64.h	/^#define __stub_revoke$/;"	d
__stub_setlogin	/usr/include/gnu/stubs-64.h	/^#define __stub_setlogin$/;"	d
__stub_sigreturn	/usr/include/gnu/stubs-64.h	/^#define __stub_sigreturn$/;"	d
__stub_stty	/usr/include/gnu/stubs-64.h	/^#define __stub_stty$/;"	d
__va_arg_pack	/usr/include/sys/cdefs.h	/^# define __va_arg_pack(/;"	d
__va_arg_pack_len	/usr/include/sys/cdefs.h	/^# define __va_arg_pack_len(/;"	d
__warnattr	/usr/include/sys/cdefs.h	/^# define __warnattr(/;"	d
__wur	/usr/include/sys/cdefs.h	/^#  define __wur /;"	d
__wur	/usr/include/sys/cdefs.h	/^# define __wur /;"	d
index	/usr/include/strings.h	/^index (char *__s, int __c) __THROW$/;"	f	typeref:typename:__extern_always_inline char *
index	/usr/include/strings.h	/^index (const char *__s, int __c) __THROW$/;"	f	typeref:typename:__extern_always_inline const char *
locale_t	/usr/include/bits/types/locale_t.h	/^typedef __locale_t locale_t;$/;"	t	typeref:typename:__locale_t
main	foo.c	/^int main(void) { return 0; }$/;"	f	typeref:typename:int
memchr	/usr/include/string.h	/^memchr (const void *__s, int __c, size_t __n) __THROW$/;"	f	typeref:typename:__extern_always_inline const void *
memchr	/usr/include/string.h	/^memchr (void *__s, int __c, size_t __n) __THROW$/;"	f	typeref:typename:__extern_always_inline void *
rindex	/usr/include/strings.h	/^rindex (char *__s, int __c) __THROW$/;"	f	typeref:typename:__extern_always_inline char *
rindex	/usr/include/strings.h	/^rindex (const char *__s, int __c) __THROW$/;"	f	typeref:typename:__extern_always_inline const char *
strchr	/usr/include/string.h	/^strchr (char *__s, int __c) __THROW$/;"	f	typeref:typename:__extern_always_inline char *
strchr	/usr/include/string.h	/^strchr (const char *__s, int __c) __THROW$/;"	f	typeref:typename:__extern_always_inline const char *
strdupa	/usr/include/string.h	/^# define strdupa(/;"	d
strerror_r	/usr/include/string.h	/^#   define strerror_r __xpg_strerror_r$/;"	d
strndupa	/usr/include/string.h	/^# define strndupa(/;"	d
strpbrk	/usr/include/string.h	/^strpbrk (char *__s, const char *__accept) __THROW$/;"	f	typeref:typename:__extern_always_inline char *
strpbrk	/usr/include/string.h	/^strpbrk (const char *__s, const char *__accept) __THROW$/;"	f	typeref:typename:__extern_always_inline const char *
strrchr	/usr/include/string.h	/^strrchr (char *__s, int __c) __THROW$/;"	f	typeref:typename:__extern_always_inline char *
strrchr	/usr/include/string.h	/^strrchr (const char *__s, int __c) __THROW$/;"	f	typeref:typename:__extern_always_inline const char *
strstr	/usr/include/string.h	/^strstr (char *__haystack, const char *__needle) __THROW$/;"	f	typeref:typename:__extern_always_inline char *
strstr	/usr/include/string.h	/^strstr (const char *__haystack, const char *__needle) __THROW$/;"	f	typeref:typename:__extern_always_inline const char *
[yamato@dev64 ctags-github]$ cat srec-ctags
cat srec-ctags
#!/bin/bash

TMPTAGS=tmp$$.tags
CTAGS=./ctags
READTAGS=./readtags

declare -a system_header_dirs=( /usr/include /usr/local/include )
declare -a local_header_dirs=( . )

output=tags
declare -a args_options
declare -a args_files
declare -a system_headers
declare -a local_headers

while [[ $# -gt 0 ]]; do
    case "$1" in
	-f|-o)
	    shift
	    output=$1
	    shift
	    ;;
	-)
	    args_optons+=( "$1" )
	    shift
	    ;;
	*)
	    args_files+=( "$1" )
	    shift
	    ;;
    esac
done

${CTAGS} "${args_options[@]}" -o "$TMPTAGS" --extras=+r --fields=+r "${args_files[@]}"

find_header_file()
{
    local h=$1
    shift

    local d
    for d in "$@"; do
	if [[ -f $d/$h ]]; then
	    echo $d/$h
	    return 0
	fi
    done
    return 1
}

member()
{
    local t=$1
    shift
    local f
    for f in "$@"; do
	if [[ $t == $f ]]; then
	    return 0
	fi
    done
    return 1
}

#
# #include <something>
#
for h in $(${READTAGS} -Q '(and (eq? $kind "h") (#/.*\<system\>.*/ $roles))' \
		       -F '(list $name #t)' -t $TMPTAGS \
		       -P -l | uniq); do
    if hx=$(find_header_file "$h" "${system_header_dirs[@]}"); then
	if ! member $hx "${args_files[@]}"; then
	    system_headers+=( $hx )
	fi
    fi
done

#
# #include "something"
#
for h in $(${READTAGS} -Q '(and (eq? $kind "h") (#/.*\<local\>.*/ $roles))' \
		       -F '(list $name #t)' -t $TMPTAGS \
		       -P -l | uniq); do
    if hx=$(find_header_file "$h" "${local_header_dirs[@]}"); then
	if ! member $hx "${args_files[@]}"; then
	    local_headers+=( $hx )
	fi
    fi
done

rm $TMPTAGS

CMD=
if [[ ${#system_headers[@]} > 0 || ${#local_headers[@]} > 0 ]]; then
    CMD="/bin/bash $0"
else
    CMD=${CTAGS}
fi
${CMD} "${args_options[@]}" -o "$output" "${args_files[@]}" "${system_headers[@]}" "${local_headers[@]}"

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

2 participants