]> gcc.gnu.org Git - gcc.git/blame - gcc/gcov-iov.c
allocator_traits.h: Fix doxygen markup.
[gcc.git] / gcc / gcov-iov.c
CommitLineData
4977bab6
ZW
1/* Generate gcov version string from version.c. See gcov-io.h for
2 description of how the version string is generated.
3 Copyright (C) 2002 Free Software Foundation, Inc.
4 Contributed by Nathan Sidwell <nathan@codesourcery.com>
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 2, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING. If not, write to the Free
20Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2102111-1307, USA. */
22
23#include "bconfig.h"
24#include "system.h"
25#include "coretypes.h"
26#include "tm.h"
27#include "version.c" /* We want the actual string. */
28
29int main PARAMS ((int, char **));
30
31int
32main (argc, argv)
33 int argc ATTRIBUTE_UNUSED;
34 char **argv;
35{
36 unsigned version = 0;
37 unsigned char v[4];
38 unsigned ix;
39 char const *ptr = version_string;
40 unsigned major, minor = 0;
41 char s = 0;
42
43 major = atoi (ptr);
44 while (*ptr && *ptr != '.')
45 ptr++;
46 if (*ptr)
47 minor = atoi (ptr + 1);
48 while (*ptr)
49 if (*ptr++ == '(')
50 {
51 s = *ptr;
52 break;
53 }
54
55 v[0] = (major < 10 ? '0' : 'A' - 10) + major;
56 v[1] = (minor / 10) + '0';
57 v[2] = (minor % 10) + '0';
58 v[3] = s ? s : '*';
59
60 for (ix = 0; ix != 4; ix++)
61 version = (version << 8) | v[ix];
62
63 printf ("/* Generated automatically by the program `%s'\n", argv[0]);
64 printf (" from `%s'. */\n", version_string);
65 printf ("\n");
66 printf ("#define GCOV_VERSION ((unsigned)%#08x) /* %.4s */\n",
67 version, v);
68
69 return 0;
70}
This page took 0.244528 seconds and 5 git commands to generate.