comparison gcc/gcov-iov.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Generate gcov version string from version.c. See gcov-io.h for 1 /* Generate gcov version string from version.c. See gcov-io.h for
2 description of how the version string is generated. 2 description of how the version string is generated.
3 Copyright (C) 2002, 2003, 2005, 2007, 2010 Free Software Foundation, Inc. 3 Copyright (C) 2002-2017 Free Software Foundation, Inc.
4 Contributed by Nathan Sidwell <nathan@codesourcery.com> 4 Contributed by Nathan Sidwell <nathan@codesourcery.com>
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
8 GCC is free software; you can redistribute it and/or modify it under 8 GCC is free software; you can redistribute it and/or modify it under
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see 19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */ 20 <http://www.gnu.org/licenses/>. */
21 21
22 #include <stdio.h> 22 #include "bconfig.h"
23 #include <stdlib.h> 23 #include "system.h"
24 24
25 /* Command line arguments are the base GCC version and the development 25 /* Command line arguments are the base GCC version and the development
26 phase (the latter may be an empty string). */ 26 phase (the latter may be an empty string). */
27 27
28 int 28 int
46 major = strtoul (ptr, &ptr, 10); 46 major = strtoul (ptr, &ptr, 10);
47 47
48 if (*ptr == '.') 48 if (*ptr == '.')
49 minor = strtoul (ptr + 1, 0, 10); 49 minor = strtoul (ptr + 1, 0, 10);
50 50
51 /* For releases the development phase is an empty string, for
52 prerelease versions on a release branch it is "prerelease".
53 Consider both equal as patch-level releases do not change
54 the GCOV version either.
55 On the trunk the development phase is "experimental". */
51 phase = argv[2][0]; 56 phase = argv[2][0];
52 if (phase == '\0') 57 if (phase == '\0'
58 || strcmp (argv[2], "prerelease") == 0)
53 phase = '*'; 59 phase = '*';
54 60
55 v[0] = (major < 10 ? '0' : 'A' - 10) + major; 61 v[0] = (major / 10) + 'A';
56 v[1] = (minor / 10) + '0'; 62 v[1] = (major % 10) + '0';
57 v[2] = (minor % 10) + '0'; 63 v[2] = minor + '0';
58 v[3] = phase; 64 v[3] = phase;
59 65
60 for (ix = 0; ix != 4; ix++) 66 for (ix = 0; ix != 4; ix++)
61 version = (version << 8) | v[ix]; 67 version = (version << 8) | v[ix];
62 68