On Fri, Dec 16, 2005 at 12:07:54PM +0100, Volker Reichelt wrote:
> > 1. contrib/gcc_update creates gcc/REVISION with branch name and
> > revision number.
> > 2. If gcc/REVISION exists, it will be used in gcc/version.c.
> >
> > With those 2 patches, I got
> >
> > [EMAIL PROTECTED] gcc]$ ./xgcc --version
> > xgcc (GCC) 4.1.0 (gcc-4_1-branch revision 108596) 20051215 (prerelease)
>
> [snip]
>
> > xgcc (GCC) 4.2.0 (trunk revision 108596) 20051215 (experimental)
>
> IMHO we should change the current naming system as little as possible
> for those who run scripts to extract the information from the compiler
> automatically. (Maybe I'm the only one, but I do.)
>
> Therefore I'd like to suggest to add the new stuff at the end and
> with brackets instead of parentheses to make that information easily
> extractable as well.
>
> xgcc (GCC) 4.1.0 20051215 (prerelease) [gcc-4_1-branch revision 108596]
> xgcc (GCC) 4.2.0 20051215 (experimental) [trunk revision 108596]
>
> Somebody on this thread also suggested to skip the date and only use
> the revision number. I don't think that this is a good idea, because
>
> 1.) there are scripts out there that rely on the date
> (OK, maybe I'm the only one)
> 2.) if we ever change the revision control system again,
> these numbers are probably obsolete
> 3.) the date carries a lot of information for humans (oh, this snapshot
> is already two month old, I should get a new one) without having
> to consult a database (for those who only download snapshots).
> And this info is available offline, too.
>
Here are the new patches. I got
[EMAIL PROTECTED] gcc-4.1]$ ./build-i686-linux/gcc/stage1/xgcc --version
xgcc (GCC) 4.1.0 20051216 (prerelease) [gcc-4_1-branch revision 108649 clean]
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
H.J.
2005-12-16 H.J. Lu <[EMAIL PROTECTED]>
* gcc_update: Create gcc/REVISION with branch name and revision
number.
Index: contrib/gcc_update
===================================================================
--- contrib/gcc_update (revision 108649)
+++ contrib/gcc_update (working copy)
@@ -250,8 +250,25 @@
exit 1
fi
+rm -f info.$$ LAST_UPDATED gcc/REVISION
+
+svn info > info.$$
+revision=`grep Revision: info.$$ | awk '{ print $2 }'`
+branch=`grep URL: info.$$ | sed -e "s,.*/,,g"`
{
date
- echo "`TZ=UTC date` (revision `svnversion .`)"
+ echo "`TZ=UTC date` (revision $revision)"
} > LAST_UPDATED
+
+rm -f info.$$
+
+changed=`svn status | grep "^[ACDGMRX\!\~]" | grep -v " contrib/"`
+if [ -n "$changed" ]; then
+ changed="modified"
+else
+ changed="clean"
+fi
+
+echo "[$branch revision $revision $changed]" > gcc/REVISION
+
touch_files_reexec
2005-12-16 H.J. Lu <[EMAIL PROTECTED]>
* Makefile.in (REVISION): New.
(REVISION_c): New.
(REVISION_s): New.
(version.o): Also depend on $(REVISION). Add
-DREVISION=$(REVISION_s).
* version.c (version_string): Add REVISION.
--- gcc/Makefile.in.rev 2005-12-04 07:17:09.000000000 -0800
+++ gcc/Makefile.in 2005-12-16 07:49:52.000000000 -0800
@@ -703,11 +703,18 @@ TM_H = $(GTM_H) insn-constants.h in
BASEVER := $(srcdir)/BASE-VER # 4.x.y
DEVPHASE := $(srcdir)/DEV-PHASE # experimental, prerelease, ""
DATESTAMP := $(srcdir)/DATESTAMP # YYYYMMDD or empty
+REVISION := $(srcdir)/REVISION # [BRANCH revision XXXXXX]
BASEVER_c := $(shell cat $(BASEVER))
DEVPHASE_c := $(shell cat $(DEVPHASE))
DATESTAMP_c := $(shell cat $(DATESTAMP))
+ifeq (,$(wildcard $(REVISION)))
+REVISION :=
+else
+REVISION_c := $(shell cat $(REVISION))
+endif
+
version := $(BASEVER_c)
# For use in version.c - double quoted strings, with appropriate
@@ -719,6 +726,12 @@ BASEVER_s := "\"$(BASEVER_c)\""
DEVPHASE_s := "\"$(if $(DEVPHASE_c), ($(DEVPHASE_c)))\""
DATESTAMP_s := "\"$(if $(DEVPHASE_c), $(DATESTAMP_c))\""
+ifdef REVISION_c
+REVISION_s := "\"$(if $(DEVPHASE_c), $(REVISION_c))\""
+else
+REVISION_s :=
+endif
+
# Shorthand variables for dependency lists.
TARGET_H = $(TM_H) target.h insn-modes.h
MACHMODE_H = machmode.h mode-classes.def insn-modes.h
@@ -1681,9 +1694,10 @@ options.o: options.c $(CONFIG_H) $(SYSTE
dumpvers: dumpvers.c
-version.o: version.c version.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
+version.o: version.c version.h $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
-DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
+ -DREVISION=$(REVISION_s) \
-DDEVPHASE=$(DEVPHASE_s) -c $(srcdir)/version.c $(OUTPUT_OPTION)
gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
--- gcc/version.c.rev 2005-11-04 14:14:18.000000000 -0800
+++ gcc/version.c 2005-12-16 07:51:30.000000000 -0800
@@ -20,6 +20,7 @@
const char bug_report_url[] = "<URL:http://gcc.gnu.org/bugs.html>";
/* The complete version string, assembled from several pieces.
- BASEVER, DATESTAMP, and DEVPHASE are defined by the Makefile. */
+ BASEVER, REVISION, DATESTAMP, and DEVPHASE are defined by the
+ Makefile. */
-const char version_string[] = BASEVER DATESTAMP DEVPHASE VERSUFFIX;
+const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION VERSUFFIX;