* config/v850/rtems.h (ASM_SPEC): Pass -m8byte-align and -mgcc-abi
[official-gcc.git] / gcc / gcov-iov.c
blob3bc7f61aec96324f783ea95c7af279c864000f07
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, 2003, 2005, 2007, 2010, 2012
4 Free Software Foundation, Inc.
5 Contributed by Nathan Sidwell <nathan@codesourcery.com>
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 3, or (at your option) any later
12 version.
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
23 #include "bconfig.h"
24 #include "system.h"
26 /* Command line arguments are the base GCC version and the development
27 phase (the latter may be an empty string). */
29 int
30 main (int argc, char **argv)
32 unsigned int version = 0;
33 unsigned char v[4];
34 unsigned int ix;
35 unsigned long major;
36 unsigned long minor = 0;
37 char phase = 0;
38 char *ptr;
40 if (argc != 3)
42 fprintf (stderr, "usage: %s 'version' 'phase'\n", argv[0]);
43 return 1;
46 ptr = argv[1];
47 major = strtoul (ptr, &ptr, 10);
49 if (*ptr == '.')
50 minor = strtoul (ptr + 1, 0, 10);
52 /* For releases the development phase is an empty string, for
53 prerelease versions on a release branch it is "prerelease".
54 Consider both equal as patch-level releases do not change
55 the GCOV version either.
56 On the trunk the development phase is "experimental". */
57 phase = argv[2][0];
58 if (phase == '\0'
59 || strcmp (argv[2], "prerelease") == 0)
60 phase = '*';
62 v[0] = (major < 10 ? '0' : 'A' - 10) + major;
63 v[1] = (minor / 10) + '0';
64 v[2] = (minor % 10) + '0';
65 v[3] = phase;
67 for (ix = 0; ix != 4; ix++)
68 version = (version << 8) | v[ix];
70 printf ("/* Generated automatically by the program `%s'\n", argv[0]);
71 printf (" from `%s (%lu %lu) and %s (%c)'. */\n",
72 argv[1], major, minor, argv[2], phase);
73 printf ("\n");
74 printf ("#define GCOV_VERSION ((gcov_unsigned_t)0x%08x) /* %.4s */\n",
75 version, v);
77 return 0;