This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH, RFA] YACC parser symbold renaming
> From: Tom Tromey <tromey@redhat.com>
> Date: Mon, 09 Apr 2012 09:07:28 -0600
>
> >>>>> "Mark" == Mark Kettenis <mark.kettenis@xs4all.nl> writes:
>
> Mark> I submitted this a couple of months ago to account for the fact that
> Mark> the OpenBSD yacc uses some additional symbols that conflict with our
> Mark> usage of multiple parsers in GDB. Joel approved it, but Tom suggested
> Mark> using the -p option. I now looked at adding the necessary Makefile
> Mark> voodoo to do that. This caused me to notice that ada-exp.y actually
> Mark> relies on the renaming macros to wrap ada_parse(). This can probably
> Mark> be fixed, but I'd really like to fix this bug since it makes gdb crash
> Mark> hard on a lot of C++ code.
>
> Mark> ok?
>
> This is fine by me.
> We can always revisit -p later.
>
> Actually... if you still have the patch, could you send it to the list?
> That might be handy.
I didn't quite finish it (started out with ada-exp.c), but here it is.
The idea was to set YFLAG-foo for each foo.y file. Works with
OpenBSD's make and should woirk with GNU make as well.
Cheers,
Mark
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1196
diff -u -p -r1.1196 Makefile.in
--- Makefile.in 28 Mar 2012 21:31:18 -0000 1.1196
+++ Makefile.in 9 Apr 2012 17:46:59 -0000
@@ -1623,11 +1623,12 @@ po/$(PACKAGE).pot: force
# Strictly speaking c-exp.c should therefore depend on
# Makefile.in, but that was a pretty big annoyance.
+YFLAGS-ada-exp = -p ada_
+
.SUFFIXES: .y .l
.y.c:
- rm -f $@ $@.tmp
- $(SHELL) $(YLWRAP) $< y.tab.c $@ -- $(YACC) $(YFLAGS) && mv $@ $@.tmp \
- || (rm -f $@; false)
+ $(SHELL) $(YLWRAP) $< y.tab.c $@ -- $(YACC) $(YFLAGS-$(*)) $(YFLAGS) \
+ && mv $@ $@.tmp || (rm -f $@; false)
sed -e '/extern.*malloc/d' \
-e '/extern.*realloc/d' \
-e '/extern.*free/d' \