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