1998-05-21 21:20:37 +02:00
|
|
|
/* Generate check macros for tree codes.
|
2000-01-17 18:16:21 +01:00
|
|
|
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
1998-05-21 21:20:37 +02:00
|
|
|
|
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
GNU CC 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 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
#include "hconfig.h"
|
|
|
|
#include "system.h"
|
|
|
|
|
2001-03-27 17:31:46 +02:00
|
|
|
#define DEFTREECODE(SYM, NAME, TYPE, LEN) STRINGX(SYM),
|
1998-05-21 21:20:37 +02:00
|
|
|
|
genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattrtab.c (fatal, attr_printf, attr_string, write_attr_set,
write_unit_name, write_eligible_delay, expand_units,
make_length_attrs, write_attr_case, find_attr,
make_internal_attr): Likewise.
* gencheck.c (tree_codes): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal, walk_rtx, copystr): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal, optabs, gen_insn): Likewise.
* genoutput.c (fatal, error, predicates): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal, decision, pred_table, add_to_sequence,
write_tree_1, write_tree, change_state, copystr, indents): Likewise.
From-SVN: r24377
1998-12-19 08:04:42 +01:00
|
|
|
const char *tree_codes[] = {
|
1998-05-21 21:20:37 +02:00
|
|
|
#include "tree.def"
|
c-common.h (IF_COND): Moved here from cp/cp-tree.h.
* c-common.h (IF_COND): Moved here from cp/cp-tree.h.
(THEN_CLAUSE): Likewise.
(ELSE_CLAUSE): Likewise.
(WHILE_COND): Likewise.
(WHILE_BODY): Likewise.
(DO_COND): Likewise.
(DO_BODY): Likewise.
(RETURN_EXPR): Likewise.
(EXPR_STMT_EXPR): Likewise.
(FOR_INIT_STMT): Likewise.
(FOR_COND): Likewise.
(FOR_EXPR): Likewise.
(FOR_BODY): Likewise.
(SWITCH_COND): Likewise.
(SWITCH_BODY): Likewise.
(CASE_LOW): Likewise.
(CASE_HIGH): Likewise.
(GOTO_DESTINATION): Likewise.
(COMPOUND_BODY): Likewise.
(ASM_CV_QUAL): Likewise.
(ASM_STRING): Likewise.
(ASM_OUTPUTS): Likewise.
(ASM_INPUTS): Likewise.
(ASM_CLOBBERS): Likewise.
(DECL_STMT_DECL): Likewise.
(STMT_EXPR_STMT): Likewise.
(LABEL_STMT_LABEL): Likewise.
(SCOPE_BEGIN_P): Likewise.
(SCOPE_END_P): Likewise.
(SCOPE_STMT_BLOCK): Likewise.
(SCOPE_NULLIFIED_P): Likewise.
(SCOPE_NO_CLEANUPS_P): Likewise.
(SCOPE_PARTIAL_P): Likewise.
(ASM_VOLATILE_P): Likewise.
(STMT_LINENO): Likewise.
(STMT_LINENO_FOR_FN_P): Likewise.
* c-common.def: Added SRCLOC, SIZEOF_EXPR, ARROW_EXPR,
ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT,
FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT,
CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT,
SCOPE_STMT, CASE_LABEL, STMT_EXPR.
* gencheck.c (tree_codes[]): Added '#include "c-common.def"'.
* cp/cp-tree.h (IF_COND): Move to c-common.h.
(THEN_CLAUSE): Likewise.
(ELSE_CLAUSE): Likewise.
(WHILE_COND): Likewise.
(WHILE_BODY): Likewise.
(DO_COND): Likewise.
(DO_BODY): Likewise.
(RETURN_EXPR): Likewise.
(EXPR_STMT_EXPR): Likewise.
(FOR_INIT_STMT): Likewise.
(FOR_COND): Likewise.
(FOR_EXPR): Likewise.
(FOR_BODY): Likewise.
(SWITCH_COND): Likewise.
(SWITCH_BODY): Likewise.
(CASE_LOW): Likewise.
(CASE_HIGH): Likewise.
(GOTO_DESTINATION): Likewise.
(COMPOUND_BODY): Likewise.
(ASM_CV_QUAL): Likewise.
(ASM_STRING): Likewise.
(ASM_OUTPUTS): Likewise.
(ASM_INPUTS): Likewise.
(ASM_CLOBBERS): Likewise.
(DECL_STMT_DECL): Likewise.
(STMT_EXPR_STMT): Likewise.
(LABEL_STMT_LABEL): Likewise.
(SCOPE_BEGIN_P): Likewise.
(SCOPE_END_P): Likewise.
(SCOPE_STMT_BLOCK): Likewise.
(SCOPE_NULLIFIED_P): Likewise.
(SCOPE_NO_CLEANUPS_P): Likewise.
(SCOPE_PARTIAL_P): Likewise.
(ASM_VOLATILE_P): Likewise.
(STMT_LINENO): Likewise.
(STMT_LINENO_FOR_FN_P): Likewise.
* cp/cp-tree.def: Removed SRCLOC, SIZEOF_EXPR, ARROW_EXPR,
ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT,
FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT,
CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT,
SCOPE_STMT, CASE_LABEL, STMT_EXPR.
* cp/Makefile.in (CXX_TREE_H): Added $(srcdir)/../c-common.def.
* cp/Make-lang.in (CXX_SRCS): Added $(srcdir)/c-common.def.
(cc1plus$(exeext)): Added $(srcdir)/c-common.def.
* cp/lex.c (cplus_tree_code_type[]): Added '#include "c-common.def"'.
(cplus_tree_code_length[]): Added '#include "c-common.def"'.
(cplus_tree_code_name[]): Added '#include "c-common.def"'.
From-SVN: r34552
2000-06-14 19:26:18 +02:00
|
|
|
#include "c-common.def"
|
1998-08-30 17:50:47 +02:00
|
|
|
#include "gencheck.h"
|
1998-05-21 21:20:37 +02:00
|
|
|
(char*)0
|
|
|
|
};
|
|
|
|
|
2000-01-17 16:17:38 +01:00
|
|
|
static void usage PARAMS ((void));
|
1999-09-15 16:13:50 +02:00
|
|
|
|
|
|
|
static void
|
|
|
|
usage ()
|
1998-05-21 21:20:37 +02:00
|
|
|
{
|
|
|
|
fprintf (stderr,"Usage: gencheck\n");
|
|
|
|
}
|
|
|
|
|
2000-01-17 16:17:38 +01:00
|
|
|
extern int main PARAMS ((int, char **));
|
1999-09-15 16:13:50 +02:00
|
|
|
|
|
|
|
int
|
|
|
|
main (argc, argv)
|
1998-05-21 21:20:37 +02:00
|
|
|
int argc;
|
1999-09-15 16:13:50 +02:00
|
|
|
char **argv ATTRIBUTE_UNUSED;
|
1998-05-21 21:20:37 +02:00
|
|
|
{
|
|
|
|
int i;
|
1998-06-29 23:40:49 +02:00
|
|
|
|
1998-05-21 21:20:37 +02:00
|
|
|
switch (argc)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
break;
|
1998-06-29 23:40:49 +02:00
|
|
|
|
1998-05-21 21:20:37 +02:00
|
|
|
default:
|
|
|
|
usage ();
|
1999-09-15 16:13:50 +02:00
|
|
|
return (1);
|
1998-05-21 21:20:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
printf ("/* This file is generated using gencheck. Do not edit. */\n");
|
|
|
|
for (i = 0; tree_codes[i]; i++)
|
|
|
|
{
|
|
|
|
printf ("#define %s_CHECK(t)\tTREE_CHECK (t, %s)\n",
|
|
|
|
tree_codes[i], tree_codes[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1998-07-17 17:00:11 +02:00
|
|
|
#if defined(USE_C_ALLOCA)
|
1998-06-06 11:25:16 +02:00
|
|
|
/* FIXME: We only need an xmalloc definition because we are forced to
|
|
|
|
link with alloca.o on some platforms. This should go away if/when
|
|
|
|
we link against libiberty.a. (ghazi@caip.rutgers.edu 6/3/98) */
|
1998-11-27 11:09:17 +01:00
|
|
|
PTR
|
1998-06-06 11:25:16 +02:00
|
|
|
xmalloc (nbytes)
|
1998-11-27 11:09:17 +01:00
|
|
|
size_t nbytes;
|
1998-06-06 11:25:16 +02:00
|
|
|
{
|
server.c (load_data, run_shell): Use xmalloc, xrealloc & xcalloc in lieu of malloc, realloc & calloc.
* fixinc/server.c (load_data, run_shell): Use xmalloc, xrealloc &
xcalloc in lieu of malloc, realloc & calloc.
* gencheck.c (xmalloc): Use really_call_malloc, not malloc.
* gengenrtl.c (xmalloc): Likewise.
* gensupport.c (xcalloc, xrealloc, xmalloc): Use the
really_call_* memory allocation routines.
* stmt.c (check_for_full_enumeration_handling): Use
really_call_calloc, not calloc.
* system.h (really_call_malloc, really_call_calloc,
really_call_realloc): Define.
(malloc, realloc, calloc, strdup, bzero, bcmp, rindex): Poison.
f:
* fini.c (main): Use really_call_malloc, not malloc.
From-SVN: r40360
2001-03-10 05:20:03 +01:00
|
|
|
register PTR tmp = (PTR) really_call_malloc (nbytes);
|
1998-06-06 11:25:16 +02:00
|
|
|
|
|
|
|
if (!tmp)
|
|
|
|
{
|
1998-07-17 17:00:11 +02:00
|
|
|
fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n",
|
|
|
|
nbytes);
|
1998-06-06 11:25:16 +02:00
|
|
|
exit (FATAL_EXIT_CODE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
1998-07-17 17:00:11 +02:00
|
|
|
#endif /* USE_C_ALLOCA */
|