OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [gcov-iov.c] - Blame information for rev 20

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* 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 Free Software Foundation, Inc.
4
   Contributed by Nathan Sidwell <nathan@codesourcery.com>
5
 
6
This file is part of GCC.
7
 
8
GCC is free software; you can redistribute it and/or modify it under
9
the terms of the GNU General Public License as published by the Free
10
Software Foundation; either version 2, or (at your option) any later
11
version.
12
 
13
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14
WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16
for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with GCC; see the file COPYING.  If not, write to the Free
20
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21
02110-1301, USA.  */
22
 
23
#include <stdio.h>
24
#include <stdlib.h>
25
 
26
/* Command line arguments are the base GCC version and the development
27
   phase (the latter may be an empty string).  */
28
 
29
int
30
main (int argc, char **argv)
31
{
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;
39
 
40
  if (argc != 3)
41
    {
42
      fprintf (stderr, "usage: %s 'version' 'phase'\n", argv[0]);
43
      return 1;
44
    }
45
 
46
  ptr = argv[1];
47
  major = strtoul (ptr, &ptr, 10);
48
 
49
  if (*ptr == '.')
50
    minor = strtoul (ptr + 1, 0, 10);
51
 
52
  phase = argv[2][0];
53
  if (phase == '\0')
54
    phase = '*';
55
 
56
  v[0] = (major < 10 ? '0' : 'A' - 10) + major;
57
  v[1] = (minor / 10) + '0';
58
  v[2] = (minor % 10) + '0';
59
  v[3] = phase;
60
 
61
  for (ix = 0; ix != 4; ix++)
62
    version = (version << 8) | v[ix];
63
 
64
  printf ("/* Generated automatically by the program `%s'\n", argv[0]);
65
  printf ("   from `%s (%lu %lu) and %s (%c)'.  */\n",
66
          argv[1], major, minor, argv[2], phase);
67
  printf ("\n");
68
  printf ("#define GCOV_VERSION ((gcov_unsigned_t)%#08x)  /* %.4s */\n",
69
          version, v);
70
 
71
  return 0;
72
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.