OSDN Git Service

* config/alpha/elf.h (ELF_ASCII_ESCAPES): Rename from ESCAPES.
[pf3gnuchains/gcc-fork.git] / gcc / gencheck.c
1 /* Generate check macros for tree codes.
2    Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2008
3    Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20
21 #include "bconfig.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25
26 #define DEFTREECODE(SYM, NAME, TYPE, LEN) #SYM,
27 #define END_OF_BASE_TREE_CODES
28
29 static const char *const tree_codes[] = {
30 #include "all-tree.def"
31 (char*) 0
32 };
33
34 #undef DEFTREECODE
35 #undef END_OF_BASE_TREE_CODES
36
37 static void usage (void);
38
39 static void
40 usage (void)
41 {
42   fputs ("Usage: gencheck\n", stderr);
43 }
44
45 int
46 main (int argc, char ** ARG_UNUSED (argv))
47 {
48   int i, j;
49
50   switch (argc)
51     {
52     case 1:
53       break;
54
55     default:
56       usage ();
57       return (1);
58     }
59
60   puts ("/* This file is generated using gencheck. Do not edit. */\n");
61   puts ("#ifndef GCC_TREE_CHECK_H");
62   puts ("#define GCC_TREE_CHECK_H\n");
63
64   /* Print macros for checks based on each of the tree code names.  However,
65      since we include the tree nodes from all languages, we must check
66      for duplicate names to avoid defining the same macro twice.  */
67   for (i = 0; tree_codes[i]; i++)
68     {
69       for (j = 0; j < i; j++)
70         if (strcmp (tree_codes[i], tree_codes[j]) == 0)
71           break;
72
73       if (i == j)
74         printf ("#define %s_CHECK(t)\tTREE_CHECK (t, %s)\n",
75                 tree_codes[i], tree_codes[i]);
76     }
77
78   puts ("\n#endif /* GCC_TREE_CHECK_H */");
79   return 0;
80 }