TAGs for variables created through common.opt
diff mbox

Message ID 53F52146.5010204@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez Aug. 20, 2014, 10:29 p.m. UTC
What are the rules for etags, is it fair game to generate them for 
variables defined in the build directory (as opposed to the source 

For instance, my editor can't find flag_generate_lto because the TAGS 
rule in Makefile.in runs etags for source file *.h files (not those in 
the build directory).  Is it fair game to generate tags for "options.h" 
in the build directory, as this patch does?

The attached patch would point flag_generate_lto to the extern 
definition below.  Not ideal, but close enough:

extern int flag_generate_lto;
   int x_flag_generate_lto;
#define flag_generate_lto global_options.x_flag_generate_lto

I suppose if we wanted to be pedantic, we should point it to the source 
in common.opt, but that would require:

a) hacking etags to support our .opt language.

b) hack one of the opt*.awk files to generate ad-hoc TAG entries directly.

c) Or perhaps even, add semicolons to the end of variable entries in the 
.opt files.  That way, we could more or less trick etags into thinking 
it's C.  Though things like HOST_WIDE_INT variables would not work.

Yes, I'm that lazy.  Why should I have to look around for something that 
can clearly be automated?


diff mbox

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 1b3820b..549e7a3 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3792,6 +3792,7 @@  paranoia: paranoia.o real.o $(LIBIBERTY)
 # Update the tags table.
 TAGS: lang.tags
+	BUILD_DIR=`pwd`;				\
 	(cd $(srcdir);					\
 	incs= ;						\
 	list='$(SUBDIRS)'; for dir in $$list; do	\
@@ -3799,7 +3800,8 @@  TAGS: lang.tags
 	    incs="$$incs --include $$dir/TAGS.sub";	\
 	  fi;						\
 	done;						\
-	etags -o TAGS.sub c-family/*.h c-family/*.c *.h *.c *.cc; \
+	etags -o TAGS.sub c-family/*.h c-family/*.c *.h *.c *.cc \
+		 $$BUILD_DIR/options.h; \
 	etags --include TAGS.sub $$incs)
 # -----------------------------------------------------