LEX vs FLEX; Was: [PATCH] Basic Ada files

Aidan Skinner aidan@velvet.net
Sat May 25 11:20:00 GMT 2002


On Thu, May 23, 2002 at 10:29:46PM -0400, Andrew Cagney wrote

> Anyway, can you just re-post this patch with a separate ChangeLog and 
> with the patch against CVS (using `cvs diff -u' or `cvs diff -p').

Attached to this email. :)

this patch is actually a fair bit smaller than the previous one, I
noticed some more stuff to chuck. It will have to be added when ada
support is enabled for things like breakpoints, but I figure smaller
is better atm.

ChangeLog:

        * gdb/Makefile.in: add entries for ada-exp.y, ada-lang.[ch],
        ada-lex.[lc], ada-tasks.c, ada-typeprint.c, ada-valprint.c

- Aidan

-------------- next part --------------
Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.200
diff -u -r1.200 Makefile.in
--- gdb/Makefile.in	24 May 2002 00:12:16 -0000	1.200
+++ gdb/Makefile.in	25 May 2002 15:21:48 -0000
@@ -79,6 +79,11 @@
 
 YACC=@YACC@
 
+# This is used to rebuild ada-lex.c from ada-lex.l.  If the program is 
+# not defined, but ada-lex.c is present, compilation will continue,
+# possibly with a warning.
+FLEX = flex
+
 YLWRAP = $(srcdir)/../ylwrap
 
 # where to find makeinfo, preferably one designed for texinfo-2
@@ -523,7 +528,8 @@
 # Links made at configuration time should not be specified here, since
 # SFILES is used in building the distribution archive.
 
-SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \
+SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
+	ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \
 	buildsym.c c-exp.y c-lang.c c-typeprint.c c-valprint.c \
 	ch-exp.c ch-lang.c ch-typeprint.c ch-valprint.c coffread.c \
 	complaints.c completer.c corefile.c cp-valprint.c dbxread.c \
@@ -735,6 +741,7 @@
 	exec.o bcache.o objfiles.o minsyms.o maint.o demangle.o \
 	dbxread.o coffread.o elfread.o \
 	dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \
+	ada-lang.o ada-typeprint.o ada-valprint.o ada-tasks.o \
 	c-lang.o ch-exp.o ch-lang.o f-lang.o \
 	ui-out.o cli-out.o \
 	varobj.o wrapper.o \
@@ -756,9 +763,11 @@
 
 # For now, shortcut the "configure GDB for fewer languages" stuff.
 YYFILES = c-exp.tab.c \
+	ada-exp.tab.c \
 	jv-exp.tab.c \
 	f-exp.tab.c m2-exp.tab.c p-exp.tab.c
 YYOBJ = c-exp.tab.o \
+	ada-exp.tab.o \
 	jv-exp.tab.o \
 	f-exp.tab.o m2-exp.tab.o p-exp.tab.o
 
@@ -1007,6 +1016,7 @@
 	@echo "This command is intended for maintainers to use;"
 	@echo "it deletes files that may require special tools to rebuild."
 	rm -f c-exp.tab.c \
+		ada-lex.c ada-exp.tab.c \
 		jv-exp.tab \
 		f-exp.tab.c m2-exp.tab.c p-exp.tab.c
 	rm -f TAGS $(INFOFILES)
@@ -1142,6 +1152,33 @@
 	-rm m2-exp.tmp
 	mv m2-exp.new ./m2-exp.tab.c
 
+# ada-exp.tab.c is generated in objdir from ada-exp.y if it doesn't exist
+# in srcdir, then compiled in objdir to ada-exp.tab.o.
+# Remove bogus decls for malloc/realloc/free which conflict with everything
+# else.
+ada-exp.tab.c: ada-exp.y 
+	$(YACC) $(YFLAGS) $(srcdir)/ada-exp.y
+	-sed -e '/extern.*malloc/d' \
+	-e '/extern.*realloc/d' \
+	-e '/extern.*free/d' \
+	-e '/include.*malloc.h/d' \
+	-e 's/malloc/xmalloc/g' \
+	-e 's/realloc/xrealloc/g' \
+	< y.tab.c > ada-exp.new
+	-rm y.tab.c
+	mv ada-exp.new ./ada-exp.tab.c
+
+ada-lex.c: ada-lex.l
+	@if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
+	    echo $(FLEX) -Isit $(srcdir)/ada-lex.l ">" ada-lex.c; \
+	    $(FLEX) -Isit $(srcdir)/ada-lex.l > ada-lex.c; \
+	elif [ ! -f ada-lex.c -a ! -f $(srcdir)/ada-lex.c ]; then \
+	    echo "ada-lex.c missing and flex not available."; \
+	    false; \
+	elif [ ! -f ada-lex.c ]; then \
+	    echo "Warning: ada-lex.c older than ada-lex.l and flex not available."; \
+	fi
+
 # p-exp.tab.c is generated in objdir from p-exp.y if it doesn't exist
 # in srcdir, then compiled in objdir to p-exp.tab.o.
 # Remove bogus decls for malloc/realloc/free which conflict with everything
@@ -1163,6 +1200,7 @@
 # These files are updated atomically, so make never has to remove them
 .PRECIOUS: m2-exp.tab.c f-exp.tab.c c-exp.tab.c
 .PRECIOUS: jv-exp.tab.c p-exp.tab.c
+.PRECIOUS: ada-exp.tab.c
 
 lint: $(LINTFILES)
 	$(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) \
@@ -1259,6 +1297,21 @@
 a68v-nat.o: a68v-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) \
 	$(regcache_h)
 
+ada-lang.o: ada-lang.c ada-lang.h c-lang.h $(defs_h) $(expression_h) \
+	$(gdbtypes_h) $(inferior_h) language.h parser-defs.h $(symtab_h) \
+	$(gdbcmd_h) $(ui_out_h) symfile.h objfiles.h $(gdbcore_h)
+
+ada-tasks.o: ada-tasks.c ada-lang.h $(defs_h) language.h $(value_h) \
+	$(command_h) $(value_h) $(gdbcore_h)
+
+ada-typeprint.o: ada-typeprint.c ada-lang.h $(defs_h) $(expression_h) \
+	$(gdbcmd_h) $(gdbcore_h) $(gdbtypes_h) language.h $(symtab_h) \
+	target.h typeprint.h $(value_h) ada-lang.h
+
+ada-valprint.o: ada-valprint.c $(defs_h) $(expression_h) $(gdbtypes_h) \
+	language.h $(symtab_h) valprint.h $(value_h) c-lang.h ada-lang.h \
+	annotate.h
+
 alpha-nat.o: alpha-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(target_h) \
 	$(regcache_h) $(alpha_tdep_h)
 
@@ -2255,6 +2312,11 @@
 	$(regcache_h)
 	$(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) \
 		$(srcdir)/z8k-tdep.c
+
+ada-exp.tab.o: ada-exp.tab.c ada-lex.c ada-lang.h \
+	$(defs_h) $(expression_h) \
+	$(gdbtypes_h) language.h parser-defs.h $(symtab_h) $(value_h) \
+	$(bfd_h) objfiles.h symfile.h
 
 c-exp.tab.o: c-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \
 	$(value_h) $(parser_defs_h) $(language_h) $(c_lang_h) $(bfd_h) \


More information about the Gdb-patches mailing list