]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gencheck.cc
Update copyright years.
[thirdparty/gcc.git] / gcc / gencheck.cc
CommitLineData
12b195d9 1/* Generate check macros for tree codes.
a945c346 2 Copyright (C) 1998-2024 Free Software Foundation, Inc.
12b195d9 3
1322177d 4This file is part of GCC.
12b195d9 5
1322177d
LB
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
9dcd6f09 8Software Foundation; either version 3, or (at your option) any later
1322177d 9version.
12b195d9 10
1322177d
LB
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
12b195d9
ML
15
16You should have received a copy of the GNU General Public License
9dcd6f09
NC
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
12b195d9 19
4977bab6 20#include "bconfig.h"
12b195d9 21#include "system.h"
4977bab6
ZW
22#include "coretypes.h"
23#include "tm.h"
12b195d9 24
9a238586 25#define DEFTREECODE(SYM, NAME, TYPE, LEN) #SYM,
c0ed0531 26#define END_OF_BASE_TREE_CODES
12b195d9 27
27c38fbe 28static const char *const tree_codes[] = {
c0ed0531 29#include "all-tree.def"
c4f2c499 30(char*) 0
12b195d9
ML
31};
32
c0ed0531
ILT
33#undef DEFTREECODE
34#undef END_OF_BASE_TREE_CODES
35
3d7aafde 36static void usage (void);
c1b59dce
KG
37
38static void
3d7aafde 39usage (void)
12b195d9 40{
0313e85b 41 fputs ("Usage: gencheck\n", stderr);
12b195d9
ML
42}
43
c1b59dce 44int
e18476eb 45main (int argc, char ** ARG_UNUSED (argv))
12b195d9 46{
cbdb4ba2 47 int i, j;
9ec36da5 48
12b195d9
ML
49 switch (argc)
50 {
51 case 1:
52 break;
9ec36da5 53
12b195d9
ML
54 default:
55 usage ();
c1b59dce 56 return (1);
12b195d9
ML
57 }
58
0313e85b
ZW
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
cbdb4ba2
RK
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. */
12b195d9
ML
66 for (i = 0; tree_codes[i]; i++)
67 {
cbdb4ba2
RK
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]);
12b195d9
ML
75 }
76
0313e85b 77 puts ("\n#endif /* GCC_TREE_CHECK_H */");
12b195d9
ML
78 return 0;
79}