diff mbox

Adapt the numbering scheme (PR gcov-profile/64874)

Message ID 1c7946d7-6778-5e57-4066-7a9cddeb0e9c@suse.cz
State New
Headers show

Commit Message

Martin Liška July 22, 2016, 11:46 a.m. UTC
Hi.

As described in the PR, current numbering scheme in gcov-io.h would overflow in couple of years.
Thus, I'm suggesting to switch from:

[major][minor/10][minor%10][release_status]

to:
[major/10][major%10][minor][release_status]

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

Comments

Nathan Sidwell July 22, 2016, 11:58 a.m. UTC | #1
On 07/22/16 07:46, Martin Liška wrote:
> Hi.
>
> As described in the PR, current numbering scheme in gcov-io.h would overflow in couple of years.
> Thus, I'm suggesting to switch from:
>
> [major][minor/10][minor%10][release_status]
>
> to:
> [major/10][major%10][minor][release_status]

If I'm reading that right, although we'll have a strange collating order that 
won't match release ordering, we won't get collisions (because the minor version 
never got above 9).

> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Yes thanks.  I was wondering when gcc's new version numbering would impact this 
ident.


nathan
Jakub Jelinek July 22, 2016, 1:20 p.m. UTC | #2
On Fri, Jul 22, 2016 at 01:46:44PM +0200, Martin Liška wrote:
> As described in the PR, current numbering scheme in gcov-io.h would overflow in couple of years.
> Thus, I'm suggesting to switch from:
> 
> [major][minor/10][minor%10][release_status]
> 
> to:
> [major/10][major%10][minor][release_status]
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Won't this clash with the already released versions?
Unless you start e.g. using different release_status letters from the past
(but that is complicated with vendor supplied DEV-PHASE), won't
say gcc 3.4.0 and gcc 30.4.1 have the same string?

Wouldn't it be better to just use letters for the major/10?  As GCC major
didn't reach 10 yet, we only had [0-9][0-9][0-9]. in the past, so I think:

-  v[0] = (major < 10 ? '0' : 'A' - 10) + major;
-  v[1] = (minor / 10) + '0';
-  v[2] = (minor % 10) + '0';
+  v[0] = (major / 10) + 'A';
+  v[1] = (major % 10) + '0';
+  v[2] = minor + '0';

would be better, then there will be no clash, and the versioning scheme will
allow until 259.9.

	Jakub
diff mbox

Patch

From 3e35f8f08558d95f5d6bd674f659c976ea86f311 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 22 Jul 2016 11:54:20 +0200
Subject: [PATCH] Adapt the numbering scheme (PR gcov-profile/64874)

gcc/ChangeLog:

2016-07-22  Martin Liska  <mliska@suse.cz>

	PR gcov-profile/64874
	* gcov-io.h: Update command about file format.
	* gcov-iov.c (main): Adapt the numbering scheme.
---
 gcc/gcov-io.h  | 17 ++++++++---------
 gcc/gcov-iov.c |  6 +++---
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index 3446407..4475d1f 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -63,19 +63,18 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
    Although the ident and version are formally 32 bit numbers, they
    are derived from 4 character ASCII strings.  The version number
-   consists of the single character major version number, a two
-   character minor version number (leading zero for versions less than
-   10), and a single character indicating the status of the release.
+   consists of a two character major version number (leading zero for versions
+   less than 10), the single character minor version number,
+   and a single character indicating the status of the release.
    That will be 'e' experimental, 'p' prerelease and 'r' for release.
    Because, by good fortune, these are in alphabetical order, string
    collating can be used to compare version strings.  Be aware that
    the 'e' designation will (naturally) be unstable and might be
-   incompatible with itself.  For gcc 3.4 experimental, it would be
-   '304e' (0x33303465).  When the major version reaches 10, the
-   letters A-Z will be used.  Assuming minor increments releases every
-   6 months, we have to make a major increment every 50 years.
-   Assuming major increments releases every 5 years, we're ok for the
-   next 155 years -- good enough for me.
+   incompatible with itself.  For gcc 7.0 experimental, it would be
+   '070e' (0x30373065).  As we currently do not release more than 5 minor
+   releases, the single character should be always fine.  Major number
+   is currently changed roughly every year, which gives us space
+   for next 90 years.
 
    A record has a tag, length and variable amount of data.
 
diff --git a/gcc/gcov-iov.c b/gcc/gcov-iov.c
index 202f32a..6685c49 100644
--- a/gcc/gcov-iov.c
+++ b/gcc/gcov-iov.c
@@ -58,9 +58,9 @@  main (int argc, char **argv)
       || strcmp (argv[2], "prerelease") == 0)
     phase = '*';
 
-  v[0] = (major < 10 ? '0' : 'A' - 10) + major;
-  v[1] = (minor / 10) + '0';
-  v[2] = (minor % 10) + '0';
+  v[0] = (major / 10) + '0';
+  v[1] = (major % 10) + '0';
+  v[2] = minor + '0';
   v[3] = phase;
 
   for (ix = 0; ix != 4; ix++)
-- 
2.9.0