]>
Commit | Line | Data |
---|---|---|
12b195d9 | 1 | /* Generate check macros for tree codes. |
66647d44 | 2 | Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2008 |
3d7aafde | 3 | Free Software Foundation, Inc. |
12b195d9 | 4 | |
1322177d | 5 | This file is part of GCC. |
12b195d9 | 6 | |
1322177d LB |
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 | |
9dcd6f09 | 9 | Software Foundation; either version 3, or (at your option) any later |
1322177d | 10 | version. |
12b195d9 | 11 | |
1322177d LB |
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. | |
12b195d9 ML |
16 | |
17 | You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
12b195d9 | 20 | |
4977bab6 | 21 | #include "bconfig.h" |
12b195d9 | 22 | #include "system.h" |
4977bab6 ZW |
23 | #include "coretypes.h" |
24 | #include "tm.h" | |
12b195d9 | 25 | |
9a238586 | 26 | #define DEFTREECODE(SYM, NAME, TYPE, LEN) #SYM, |
c0ed0531 | 27 | #define END_OF_BASE_TREE_CODES |
12b195d9 | 28 | |
27c38fbe | 29 | static const char *const tree_codes[] = { |
c0ed0531 | 30 | #include "all-tree.def" |
c4f2c499 | 31 | (char*) 0 |
12b195d9 ML |
32 | }; |
33 | ||
c0ed0531 ILT |
34 | #undef DEFTREECODE |
35 | #undef END_OF_BASE_TREE_CODES | |
36 | ||
3d7aafde | 37 | static void usage (void); |
c1b59dce KG |
38 | |
39 | static void | |
3d7aafde | 40 | usage (void) |
12b195d9 | 41 | { |
0313e85b | 42 | fputs ("Usage: gencheck\n", stderr); |
12b195d9 ML |
43 | } |
44 | ||
c1b59dce | 45 | int |
e18476eb | 46 | main (int argc, char ** ARG_UNUSED (argv)) |
12b195d9 | 47 | { |
cbdb4ba2 | 48 | int i, j; |
9ec36da5 | 49 | |
12b195d9 ML |
50 | switch (argc) |
51 | { | |
52 | case 1: | |
53 | break; | |
9ec36da5 | 54 | |
12b195d9 ML |
55 | default: |
56 | usage (); | |
c1b59dce | 57 | return (1); |
12b195d9 ML |
58 | } |
59 | ||
0313e85b ZW |
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 | ||
cbdb4ba2 RK |
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. */ | |
12b195d9 ML |
67 | for (i = 0; tree_codes[i]; i++) |
68 | { | |
cbdb4ba2 RK |
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]); | |
12b195d9 ML |
76 | } |
77 | ||
0313e85b | 78 | puts ("\n#endif /* GCC_TREE_CHECK_H */"); |
12b195d9 ML |
79 | return 0; |
80 | } |