public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Report branch/revsion info from "gcc -v"
@ 2007-07-30 16:43 H.J. Lu
  2007-07-30 17:29 ` Andreas Schwab
  0 siblings, 1 reply; 15+ messages in thread
From: H.J. Lu @ 2007-07-30 16:43 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 934 bytes --]

"gcc -v" only reports very limited branch/revsion info like:

4.3.0 20070730 (experimental)
4.2.1 20070702 (prerelease) 

There may be quite a few checkins within a day. "4.3.0 20070730"
doesn't tell which revision it is. However, you can't expand the
revision number from subversion checkout command. I am enclosing 2
patches to get the branch info and the revision number from
contrib/gcc_update. I now get

# /usr/gcc-4.3/bin/gcc -v
...
gcc version 4.3.0 20070724 (experimental) [trunk revision 126877]
# /usr/gcc-4.2/bin/gcc -v
...
gcc version 4.2.1 20070710 (prerelease) [gcc-4_2-branch revision 126519]
# /usr/gcc-4.1-redhat/bin/gcc -v
...
gcc version 4.1.3 20070626 (Red Hat 4.1.2-14) [redhat/gcc-4_1-branch revision 126103]

If you don't use contrib/gcc_update to update gcc source tree, nothing
is changed. I have been using them for more than a year like:

http://gcc.gnu.org/ml/gcc-testresults/2007-07/msg01061.html


H.J.

[-- Attachment #2: gcc-rev-3.patch --]
[-- Type: text/plain, Size: 2469 bytes --]

2006-01-23  H.J. Lu  <hongjiu.lu@intel.com>

	* 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	2006-01-23 10:00:31.000000000 -0800
+++ gcc/Makefile.in	2006-01-23 10:29:38.000000000 -0800
@@ -710,11 +710,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
@@ -726,6 +733,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
@@ -1742,9 +1755,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	2006-01-23 10:30:19.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, DATESTAMP, DEVPHASE, and REVISION are defined by the
+   Makefile.  */
 
-const char version_string[] = BASEVER DATESTAMP DEVPHASE VERSUFFIX;
+const char version_string[] = BASEVER DATESTAMP DEVPHASE VERSUFFIX REVISION;

[-- Attachment #3: gcc-update-rev-6.patch --]
[-- Type: text/plain, Size: 647 bytes --]

Index: contrib/gcc_update
===================================================================
--- contrib/gcc_update	(revision 116299)
+++ contrib/gcc_update	(working copy)
@@ -255,8 +255,18 @@ if [ $? -ne 0 ]; then
     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,.*/gcc/,,g" | sed -e "s,branches/,,"`
 {
   date
-  echo "`TZ=UTC date` (revision `svnversion .`)"
+  echo "`TZ=UTC date` (revision $revision)"
 } > LAST_UPDATED
+
+rm -f info.$$
+
+echo "[$branch revision $revision]" > gcc/REVISION
+
 touch_files_reexec

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-08-16 21:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-30 16:43 PATCH: Report branch/revsion info from "gcc -v" H.J. Lu
2007-07-30 17:29 ` Andreas Schwab
2007-07-30 17:57   ` H.J. Lu
2007-07-30 18:07     ` Andreas Schwab
2007-07-30 18:27       ` H.J. Lu
2007-08-06 21:15         ` Ralf Wildenhues
2007-08-08 14:22           ` H.J. Lu
2007-08-08 20:58             ` Ralf Wildenhues
2007-08-08 22:35               ` H.J. Lu
2007-08-09  7:39                 ` Ralf Wildenhues
2007-08-16 18:36                 ` Alexandre Oliva
2007-08-16 19:18                   ` H.J. Lu
2007-08-16 20:50                     ` Alexandre Oliva
2007-08-16 21:07                       ` H.J. Lu
2007-08-09  9:09         ` Manuel López-Ibáñez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).