bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: --version for CVS Bison


From: Joel E. Denny
Subject: Re: --version for CVS Bison
Date: Tue, 30 May 2006 12:47:11 -0400 (EDT)

On Tue, 30 May 2006, Akim Demaille wrote:

> >>> "Joel" == Joel E Denny <address@hidden> writes:
> 
>  > On Tue, 30 May 2006, Akim Demaille wrote:
>  >> Le 29 mai 06 ? 20:25, Joel E. Denny a ?crit :
>  >>
>  >> > > I would have selected Joel's solution, but with a new change-id.c file
>  >> > > to save cycles.
>  >> >
>  >> > What would be in that file?
>  >>
>  >> A const char * with the revision.  The point is to minimize
>  >> what has to be recompiled.
> 
>  > Ok, I guess it's possible it might be used in other files at some point.
> 
> I'm not sure what you mean here, but, yes

Sorry, I was agreeing with you by explaining what I thought to be the 
point of your suggestion.  That is, although the ChangeLog Id is only used 
in one file (getargs.c) right now, it might be used in others in the 
future.  If and when that happens, your approach will improve 
re-compilation time.  Did I get it?

>, we would change
> getargs.c:version to output "revision".  Or, indeed, you can keep the
> change-id.h, included by change-id.c that compiles it.  Others just
> link to it.

I was going to name them "changelog-id.h", "changelog-id.c", "const char 
*changelog_id".  Are you saying you prefer "change-id.h", "change-id.c", 
and "const char *revision"?

> - this:
> 
> +     if ( echo '@VERSION@' | grep + >/dev/null 2>&1 ); then \
> +       grep '^$$Id' $(top_srcdir)/ChangeLog \
> +         | sed 's/$$$$/$$\\n"/' >> $@; \
> +     else \
> +       echo '"' >> $@; \
> +     fi
> 
> is actually a case to save an echo, a subshell, and a grep.  Using @@
> is discouraged: use $() instead.  Also, I'm not sure all the greps out
> there will understand your $ properly.

Thanks for the tips.

> case "$(VERSION)" in
>   *+*) sed -n 's/^\$$\(Id.*\)\$$$$/const char *revision = "\1";/p' \
>        $(top_srcdir)/ChangeLog
>        ;;
> esac >$@

This doesn't handle the case of no `+'.  This works for me:

changelog-id.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog
        case "$(VERSION)" in \
          *+*) sed -n \
            's/^\$$\(Id.*\)\$$$$/const char *changelog_id = "\1\\n";/p' \
            $(top_srcdir)/ChangeLog \
            ;; \
          *) echo 'const char *changelog_id = "";' \
            ;; \
        esac >$@

Besides file and variable names, is that OK?

Joel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]