ctags icon indicating copy to clipboard operation
ctags copied to clipboard

Make: add CppDef extra for extracting FOO in -DFOO as a macro of CPreProcessor

Open masatake opened this issue 1 year ago • 2 comments

See https://github.com/bootlin/elixir/issues/221 .

input.mak:

CPPFLAGS = -DOUTPUT=stdout
foo.o: foo.c
	$(CC) $(CPPFLAGS) $<

Output:

$ ./ctags --extras-Make='+{CppDef}' --fields=+lE -o - input.mak 
CPPFLAGS	input.mak	/^CPPFLAGS = -DOUTPUT=stdout$/;"	m	language:Make
OUTPUT	input.mak	/^CPPFLAGS = -DOUTPUT=stdout$/;"	d	language:CPreProcessor	extras:CppDef
foo.o	input.mak	/^foo.o: foo.c$/;"	t	language:Make

When --extras-Make='+{CppDef}' is given, the Make parser extracts OUTPUT.

Violent heuristics, but I know this is useful when reading a source tree like Linux kernel. I have tried hard to make the impact on the original code small.

masatake avatar Jun 25 '24 16:06 masatake

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.45%. Comparing base (ac6c14c) to head (c16adc6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4024      +/-   ##
==========================================
+ Coverage   85.42%   85.45%   +0.03%     
==========================================
  Files         235      235              
  Lines       56729    56848     +119     
==========================================
+ Hits        48462    48582     +120     
+ Misses       8267     8266       -1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 25 '24 16:06 codecov[bot]

We must merge #4025 first. The coverage must be 100%.

masatake avatar Jun 26 '24 16:06 masatake

The last one line the test cases don't cover looks a bit strange for me. Though I have modified the line, I cannot convince we need the line. I took more time for inspecting the line before merging.

masatake avatar Jul 10 '24 01:07 masatake