]>
Commit | Line | Data |
---|---|---|
3e207e38 | 1 | /* Generate check macros for tree codes. |
0ba508e4 | 2 | Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 |
1a97be37 | 3 | Free Software Foundation, Inc. |
3e207e38 | 4 | |
f12b58b3 | 5 | This file is part of GCC. |
3e207e38 | 6 | |
f12b58b3 | 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 2, or (at your option) any later | |
10 | version. | |
3e207e38 | 11 | |
f12b58b3 | 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. | |
3e207e38 | 16 | |
17 | You should have received a copy of the GNU General Public License | |
f12b58b3 | 18 | along with GCC; see the file COPYING. If not, write to the Free |
19 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
3e207e38 | 21 | |
805e22b2 | 22 | #include "bconfig.h" |
3e207e38 | 23 | #include "system.h" |
805e22b2 | 24 | #include "coretypes.h" |
25 | #include "tm.h" | |
3e207e38 | 26 | |
18e43155 | 27 | #define DEFTREECODE(SYM, NAME, TYPE, LEN) #SYM, |
3e207e38 | 28 | |
35823b64 | 29 | static const char *const tree_codes[] = { |
3e207e38 | 30 | #include "tree.def" |
92915e1c | 31 | #include "c-common.def" |
c3cc26e1 | 32 | #include "gencheck.h" |
dfe09cce | 33 | (char*) 0 |
3e207e38 | 34 | }; |
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 | } |