]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/genconstants.c
Fix ada enabled "make html".
[thirdparty/gcc.git] / gcc / genconstants.c
CommitLineData
1b0c37d7
ZW
1/* Generate from machine description:
2 a series of #define statements, one for each constant named in
3 a (define_constants ...) pattern.
4
f30278e8 5 Copyright (C) 1987, 1991, 1995, 1998, 1999, 2000, 2001, 2003, 2004
3d7aafde 6 Free Software Foundation, Inc.
1b0c37d7 7
40803cd5 8This file is part of GCC.
1b0c37d7 9
40803cd5 10GCC is free software; you can redistribute it and/or modify
1b0c37d7
ZW
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2, or (at your option)
13any later version.
14
40803cd5 15GCC is distributed in the hope that it will be useful,
1b0c37d7
ZW
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
40803cd5 21along with GCC; see the file COPYING. If not, write to
1b0c37d7
ZW
22the Free Software Foundation, 59 Temple Place - Suite 330,
23Boston, MA 02111-1307, USA. */
24
25/* This program does not use gensupport.c because it does not need to
26 look at insn patterns, only (define_constants), and we want to
27 minimize dependencies. */
28
4977bab6 29#include "bconfig.h"
1b0c37d7 30#include "system.h"
4977bab6
ZW
31#include "coretypes.h"
32#include "tm.h"
1b0c37d7
ZW
33#include "rtl.h"
34#include "errors.h"
35#include "gensupport.h"
36
1b0c37d7
ZW
37/* Called via traverse_md_constants; emit a #define for
38 the current constant definition. */
39
40static int
3d7aafde 41print_md_constant (void **slot, void *info)
1b0c37d7 42{
28dab132
BI
43 struct md_constant *def = (struct md_constant *) *slot;
44 FILE *file = (FILE *) info;
1b0c37d7
ZW
45
46 fprintf (file, "#define %s %s\n", def->name, def->value);
47 return 1;
48}
49
50int
3d7aafde 51main (int argc, char **argv)
1b0c37d7 52{
1b0c37d7
ZW
53 progname = "genconstants";
54
f9942f4e 55 if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
1b0c37d7
ZW
56 return (FATAL_EXIT_CODE);
57
f9942f4e
ZW
58 /* Initializing the MD reader has the side effect of loading up
59 the constants table that we wish to scan. */
1b0c37d7
ZW
60
61 puts ("/* Generated automatically by the program `genconstants'");
62 puts (" from the machine description file `md'. */\n");
63 puts ("#ifndef GCC_INSN_CONSTANTS_H");
64 puts ("#define GCC_INSN_CONSTANTS_H\n");
65
66 traverse_md_constants (print_md_constant, stdout);
67
68 puts ("\n#endif /* GCC_INSN_CONSTANTS_H */");
69
70 if (ferror (stdout) || fflush (stdout) || fclose (stdout))
71 return FATAL_EXIT_CODE;
72
73 return SUCCESS_EXIT_CODE;
74}