[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] [PATCH] dependency for parallel make (bison)
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] [PATCH] dependency for parallel make (bison) |
Date: |
Tue, 12 Sep 2017 14:53:08 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Oops: we should also delete this obsolete comment from Makefile.am:
# Use of awk instead of $(AWK) is deliberate, in case gawk doesn't build
# or work correctly.
On Tue, Sep 12, 2017 at 02:49:59PM -0400, Andrew J. Schorr wrote:
> Hi,
>
> On Tue, Sep 12, 2017 at 12:34:44PM -0600, address@hidden wrote:
> > We already rely on the parser generator being Bison beause of the -p
> > option, so using -o is not awful. I am adding a note in the README.
>
> Good.
>
> > > > With
> > > > -o, we could eliminate the bisonfix.awk hack for awkgram.y as well, but
> > > > that
> > > > rule is a bit messier because of the shenanigans with y.tab.h.
> >
> > Andy, please pull in a litle bit and then if you can come up
> > with such a fix, that'd be great.
>
> The current rule says:
>
> awkgram.c: awkgram.y
> $(YACC) $(AM_YFLAGS) $(YFLAGS) $<
> sed 's/parse error/syntax error/g' < y.tab.c | awk -f
> "$(srcdir)"/bisonfix.awk awkgram > $*.c && rm y.tab.c
> if test -f y.tab.h; then \
> if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
> else :; fi
>
> What is the purpose of the y.tab.h manipulations? When I run bison, I do
> not see any y.tab.h file being produced, so I don't understand the goal
> of that part of the rule. Is it generated on some platforms, and if so, why
> do we rename it to awkgram.h? The simple fix is to remove that:
>
> awkgram.c: awkgram.y
> $(YACC) -o $@ $(AM_YFLAGS) $(YFLAGS) $<
> sed 's/parse error/syntax error/g' < $@ > address@hidden && mv
> address@hidden $@
>
> But perhaps there is a good reason for mucking with y.tab.h that I do
> not understand...
>
> The full patch is attached. And we can now remove bisonfix.awk from the
> repository.
>
> Regards,
> Andy
> diff --git a/Makefile.am b/Makefile.am
> index 0d2efd1..3a9cf15 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -40,7 +40,6 @@ EXTRA_DIST = \
> NEWS.0 \
> POSIX.STD \
> README_d \
> - bisonfix.awk \
> config.guess \
> config.rpath \
> config.sub \
> @@ -187,15 +186,12 @@ dist-hook:
> # or work correctly.
>
> awkgram.c: awkgram.y
> - $(YACC) $(AM_YFLAGS) $(YFLAGS) $<
> - sed 's/parse error/syntax error/g' < y.tab.c | awk -f
> "$(srcdir)"/bisonfix.awk awkgram > $*.c && rm y.tab.c
> - if test -f y.tab.h; then \
> - if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
> - else :; fi
> + $(YACC) -o $@ $(AM_YFLAGS) $(YFLAGS) $<
> + sed 's/parse error/syntax error/g' < $@ > address@hidden && mv
> address@hidden $@
>
> command.c: command.y
> - $(YACC) -p zz $<
> - sed 's/parse error/syntax error/g' < y.tab.c | awk -f
> "$(srcdir)"/bisonfix.awk command > $*.c && rm y.tab.c
> + $(YACC) -o $@ -p zz $<
> + sed 's/parse error/syntax error/g' < $@ > address@hidden && mv
> address@hidden $@
>
> # This is for my development & testing.
> efence: gawk
--
Andrew Schorr e-mail: address@hidden
Telemetry Investments, L.L.C. phone: 917-305-1748
545 Fifth Ave, Suite 1108 fax: 212-425-5550
New York, NY 10017-3630