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

Cxx: support typeof and __typeof__ keywords of the gcc extension #3621

Merged
merged 4 commits into from
Jan 8, 2023

Conversation

masatake
Copy link
Member

@masatake masatake commented Jan 7, 2023

The parser treats them the same as decltype keyword of the C++ standard.
Close #3620.

An example:

input.c:

// Derrived from glibc
# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg)))
# define weak_alias(name, aliasname) _weak_alias (name, aliasname)
# define _weak_alias(name, aliasname) \
  extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \
    __attribute_copy__ (name);

int
__brk (void *addr)
{
	/* ... */
	return 0;
}
weak_alias (__brk, brk)

cmdline: ./ctags --param-CPreProcessor._expand=true --fields-C=+'{macrodef}' --fields=+'{signature}' --kinds-C=+x -o - input.c

tags output:

__attribute_copy__	/tmp/baz.c	/^# define __attribute_copy__(/;"	d	file:	signature:(arg)	macrodef:__attribute__ ((__copy__ (arg)))
__brk	/tmp/baz.c	/^__brk (void *addr)$/;"	f	typeref:typename:int	signature:(void * addr)
_weak_alias	/tmp/baz.c	/^# define _weak_alias(/;"	d	file:	signature:(name,aliasname)	macrodef:extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) __attribute_copy__ (name);
brk	/tmp/baz.c	/^weak_alias (__brk, brk)$/;"	x	typeref:typename:__typeof(__brk)
weak_alias	/tmp/baz.c	/^# define weak_alias(name, aliasname) _weak_alias /;"	d	file:	signature:(name,aliasname)	macrodef:_weak_alias (name, aliasname)

brk is extracted well.

Use CXX_DEBUG_PRINT instead.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
The parser treats them the same as decltype keyword of the C++ standard.

Close universal-ctags#3620.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…elds

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@codecov
Copy link

codecov bot commented Jan 7, 2023

Codecov Report

Base: 82.81% // Head: 82.81% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (8a6c482) compared to base (dfdabb5).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3621   +/-   ##
=======================================
  Coverage   82.81%   82.81%           
=======================================
  Files         223      223           
  Lines       54451    54462   +11     
=======================================
+ Hits        45092    45103   +11     
  Misses       9359     9359           
Impacted Files Coverage Δ
parsers/cxx/cxx_keyword.c 100.00% <100.00%> (ø)
parsers/cxx/cxx_parser_variable.c 91.68% <100.00%> (+0.11%) ⬆️
parsers/cxx/cxx_token_chain.c 82.41% <100.00%> (+0.14%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake merged commit 129d7e2 into universal-ctags:master Jan 8, 2023
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

Successfully merging this pull request may close these issues.

C: support typeof gcc extension
1 participant