OSDN Git Service

* gcc.c-torture/compile/pr11832.c: XFAIL for mips and powerpc-linux,
[pf3gnuchains/gcc-fork.git] / gcc / gencheck.c
1 /* Generate check macros for tree codes.
2    Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007
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
28 static const char *const tree_codes[] = {
29 #include "tree.def"
30 #include "c-common.def"
31 #include "gencheck.h"
32 (char*) 0
33 };
34
35 static void usage (void);
36
37 static void
38 usage (void)
39 {
40   fputs ("Usage: gencheck\n", stderr);
41 }
42
43 int
44 main (int argc, char ** ARG_UNUSED (argv))
45 {
46   int i, j;
47
48   switch (argc)
49     {
50     case 1:
51       break;
52
53     default:
54       usage ();
55       return (1);
56     }
57
58   puts ("/* This file is generated using gencheck. Do not edit. */\n");
59   puts ("#ifndef GCC_TREE_CHECK_H");
60   puts ("#define GCC_TREE_CHECK_H\n");
61
62   /* Print macros for checks based on each of the tree code names.  However,
63      since we include the tree nodes from all languages, we must check
64      for duplicate names to avoid defining the same macro twice.  */
65   for (i = 0; tree_codes[i]; i++)
66     {
67       for (j = 0; j < i; j++)
68         if (strcmp (tree_codes[i], tree_codes[j]) == 0)
69           break;
70
71       if (i == j)
72         printf ("#define %s_CHECK(t)\tTREE_CHECK (t, %s)\n",
73                 tree_codes[i], tree_codes[i]);
74     }
75
76   puts ("\n#endif /* GCC_TREE_CHECK_H */");
77   return 0;
78 }