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, 6 Jun 2006 01:24:47 -0400 (EDT)

On Wed, 31 May 2006, Joel E. Denny wrote:

> On Wed, 31 May 2006, Akim Demaille wrote:
> 
> >  > I was going to name them "changelog-id.h", "changelog-id.c", "const char 
> > 
> > I meant changelog-id.  Anyway, I personally use revision.c ;)
> 
> Now I don't like "changelog-id".  The current use of the ChangeLog Id for 
> the revision is a detail that could potentially change.  The most 
> important thing about this variable is that it's the Bison "revision".
> 
> Unless there are objections, I'll apply my updated patch after 2.3 is out.

Thanks for releasing 2.3 Paul.

I installed the following.

Joel

Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1492
diff -p -u -r1.1492 ChangeLog
--- ChangeLog   5 Jun 2006 07:45:41 -0000       1.1492
+++ ChangeLog   6 Jun 2006 05:18:41 -0000
@@ -1,3 +1,22 @@
+$Id$
+
+2006-06-06  Joel E. Denny  <address@hidden>
+
+       Between Bison releases, manually append `+' to the previous Bison
+       release number, and use that as a signal to automatically print the
+       ChangeLog's CVS Id keyword from --version.  Discussed starting at
+       <http://lists.gnu.org/archive/html/bison-patches/2006-05/msg00028.html>.
+       * ChangeLog: Add Id header.
+       * configure.ac (AC_INIT): Append `+' to `2.3'.
+       * src/.cvsignore: Add revision.c.
+       * src/Makefile.am (bison_SOURCES): Add revision.c and revision.h.
+       (BUILT_SOURCES): Add revision.c.
+       (revision.c): New target rule.  This file defines a new global variable
+       named revision.  It initializes it with either the Id from ChangeLog
+       or, if VERSION doesn't contain `+', with the empty string.
+       * src/getargs.c (version): Print the value of revision.
+       * src/revision.h: Extern revision.
+
 2006-06-05  Paul Eggert  <address@hidden>
 
        * NEWS: Version 2.3.
Index: configure.ac
===================================================================
RCS file: /sources/bison/bison/configure.ac,v
retrieving revision 1.67
diff -p -u -r1.67 configure.ac
--- configure.ac        5 Jun 2006 07:45:41 -0000       1.67
+++ configure.ac        6 Jun 2006 05:18:41 -0000
@@ -24,7 +24,7 @@
 # least Autoconf 2.59.
 AC_PREREQ(2.59)
 
-AC_INIT([GNU Bison], [2.3], address@hidden)
+AC_INIT([GNU Bison], [2.3+], address@hidden)
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
Index: src/.cvsignore
===================================================================
RCS file: /sources/bison/bison/src/.cvsignore,v
retrieving revision 1.16
diff -p -u -r1.16 .cvsignore
--- src/.cvsignore      3 May 2004 07:36:12 -0000       1.16
+++ src/.cvsignore      6 Jun 2006 05:18:41 -0000
@@ -5,6 +5,7 @@
 Makefile
 Makefile.in
 bison
+revision.c
 scan-gram.c
 scan-skel.c
 yacc
Index: src/Makefile.am
===================================================================
RCS file: /sources/bison/bison/src/Makefile.am,v
retrieving revision 1.67
diff -p -u -r1.67 Makefile.am
--- src/Makefile.am     9 Dec 2005 23:51:25 -0000       1.67
+++ src/Makefile.am     6 Jun 2006 05:18:41 -0000
@@ -52,6 +52,7 @@ bison_SOURCES =                                         \
        print_graph.c print_graph.h               \
        reader.c reader.h                         \
        reduce.c reduce.h                         \
+       revision.c revision.h                     \
        relation.c relation.h                     \
        scan-gram-c.c                             \
        scan-skel-c.c scan-skel.h                 \
@@ -66,7 +67,7 @@ bison_SOURCES =                                         \
 
 EXTRA_bison_SOURCES = scan-skel.l scan-gram.l
 
-BUILT_SOURCES = scan-skel.c scan-gram.c parse-gram.c parse-gram.h
+BUILT_SOURCES = revision.c scan-skel.c scan-gram.c parse-gram.c parse-gram.h
 
 MOSTLYCLEANFILES = yacc
 
@@ -78,6 +79,16 @@ yacc:
 echo:
        echo $(bison_SOURCES) $(noinst_HEADERS)
 
+revision.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog
+       case "$(VERSION)" in \
+         *+*) sed -n \
+           's/^\$$\(Id.*\)\$$$$/const char *revision = "\1\\n";/p' \
+           $(top_srcdir)/ChangeLog \
+           ;; \
+         *) echo 'const char *revision = "";' \
+           ;; \
+       esac >$@
+
 # The following rule is not designed to be portable,
 # and relies on tools that not everyone has.
 
Index: src/getargs.c
===================================================================
RCS file: /sources/bison/bison/src/getargs.c,v
retrieving revision 1.70
diff -p -u -r1.70 getargs.c
--- src/getargs.c       30 May 2006 16:11:45 -0000      1.70
+++ src/getargs.c       6 Jun 2006 05:18:41 -0000
@@ -22,6 +22,7 @@
 
 #include <config.h>
 #include "system.h"
+#include "revision.h"
 
 #include <argmatch.h>
 #include <error.h>
@@ -272,6 +273,7 @@ version (void)
      continue.  */
   printf (_("bison (GNU Bison) %s"), VERSION);
   putc ('\n', stdout);
+  printf ("%s", revision);
   fputs (_("Written by Robert Corbett and Richard Stallman.\n"), stdout);
   putc ('\n', stdout);
 
Index: src/revision.h
===================================================================
RCS file: src/revision.h
diff -N src/revision.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/revision.h      6 Jun 2006 05:18:41 -0000
@@ -0,0 +1,27 @@
+/* Between Bison releases, define a precise revision string.
+
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+   This file is part of Bison, the GNU Compiler Compiler.
+
+   Bison is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   Bison is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with Bison; see the file COPYING.  If not, write to the Free
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.  */
+
+#ifndef REVISION_H_
+# define REVISION_H_
+
+extern const char *revision;
+
+#endif /* !REVISION_H_ */




reply via email to

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