c0ed0531e5
* tree.h (enum tree_code): Include all-tree.def, not tree.def. Define END_OF_BASE_TREE_CODES around inclusion. * tree.c (tree_code_type): New global array. (tree_code_length, tree_code_name): Likewise. * Makefile.in (TREE_H): Add all-tree.def, c-common.def, and $(lang_tree_files). (all-tree.def, s-alltree): New targets. (gencheck.h, s-gencheck): Remove. (tree.o): Depend upon all-tree.def. (build/gencheck.o): Remove gencheck.h dependency. (mostlyclean): Don't remove gencheck.h. * c-common.h (enum c_tree_code): Remove. * c-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * gencheck.c (tree_codes): Include all-tree.def, rather than tree.def, c-common.def, and gencheck.h. Undefined DEFTREECODE after it is used. * tree-browser.c (tb_tree_codes): Include all-tree.def, rather than tree.def. * cp/cp-tree.h (enum cplus_tree_code): Remove. (operator_name_info): Size to MAX_TREE_CODES. (assignment_operator_name_info): Likewise. * cp/cp-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * cp/lex.c (operator_name_info): Size to MAX_TREE_CODES. (assignment_operator_name_info): Likewise. * cp/decl.c (grok_op_properties): Change LAST_CPLUS_TREE_CODE to MAX_TREE_CODES. * cp/mangle.c (write_expression): Likewise. * cp/Make-lang.in (CXX_TREE_H): Remove cp/cp-tree.def. * fortran/f95-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * java/java-tree.h (enum java_tree_code): Remove. * java/lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * java/Make-lang.in (JAVA_TREE_H): Remove java/java-tree.def. * objc/objc-act.h (enum objc_tree_code): Remove. * objc/objc-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * objcp/objcp-lang.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. * ada/ada-tree.h (enum gnat_tree_code): Remove. * ada/Make-lang.in (ADA_TREE_H): Remove ada/ada-tre.def. * ada/misc.c (tree_code_type): Remove. (tree_code_length, tree_code_name): Remove. From-SVN: r137006
81 lines
1.9 KiB
C
81 lines
1.9 KiB
C
/* Generate check macros for tree codes.
|
|
Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007
|
|
Free Software Foundation, Inc.
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
version.
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GCC; see the file COPYING3. If not see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include "bconfig.h"
|
|
#include "system.h"
|
|
#include "coretypes.h"
|
|
#include "tm.h"
|
|
|
|
#define DEFTREECODE(SYM, NAME, TYPE, LEN) #SYM,
|
|
#define END_OF_BASE_TREE_CODES
|
|
|
|
static const char *const tree_codes[] = {
|
|
#include "all-tree.def"
|
|
(char*) 0
|
|
};
|
|
|
|
#undef DEFTREECODE
|
|
#undef END_OF_BASE_TREE_CODES
|
|
|
|
static void usage (void);
|
|
|
|
static void
|
|
usage (void)
|
|
{
|
|
fputs ("Usage: gencheck\n", stderr);
|
|
}
|
|
|
|
int
|
|
main (int argc, char ** ARG_UNUSED (argv))
|
|
{
|
|
int i, j;
|
|
|
|
switch (argc)
|
|
{
|
|
case 1:
|
|
break;
|
|
|
|
default:
|
|
usage ();
|
|
return (1);
|
|
}
|
|
|
|
puts ("/* This file is generated using gencheck. Do not edit. */\n");
|
|
puts ("#ifndef GCC_TREE_CHECK_H");
|
|
puts ("#define GCC_TREE_CHECK_H\n");
|
|
|
|
/* Print macros for checks based on each of the tree code names. However,
|
|
since we include the tree nodes from all languages, we must check
|
|
for duplicate names to avoid defining the same macro twice. */
|
|
for (i = 0; tree_codes[i]; i++)
|
|
{
|
|
for (j = 0; j < i; j++)
|
|
if (strcmp (tree_codes[i], tree_codes[j]) == 0)
|
|
break;
|
|
|
|
if (i == j)
|
|
printf ("#define %s_CHECK(t)\tTREE_CHECK (t, %s)\n",
|
|
tree_codes[i], tree_codes[i]);
|
|
}
|
|
|
|
puts ("\n#endif /* GCC_TREE_CHECK_H */");
|
|
return 0;
|
|
}
|