gcc/gcc/gencheck.c

90 lines
2.0 KiB
C
Raw Normal View History

/* Generate check macros for tree codes.
2000-01-17 18:16:21 +01:00
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
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"
#define DEFTREECODE(SYM, NAME, TYPE, LEN) STRINGX(SYM),
const char *tree_codes[] = {
#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"
#include "gencheck.h"
(char*)0
};
static void usage PARAMS ((void));
static void
usage ()
{
fprintf (stderr,"Usage: gencheck\n");
}
extern int main PARAMS ((int, char **));
int
main (argc, argv)
int argc;
char **argv ATTRIBUTE_UNUSED;
{
int i;
switch (argc)
{
case 1:
break;
default:
usage ();
return (1);
}
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;
}
#if defined(USE_C_ALLOCA)
/* 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) */
system.h: Include libiberty.h. * system.h: Include libiberty.h. * c-aux-info.c: Remove prototypes for concat/concat3. Change function `concat' from fixed parameters to variable parameters, as is done in libiberty. All callers of concat/concat3 changed to use the new `concat' with variable args. * cccp.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. * cexp.y: Likewise. * collect2.c: Likewise. * config/1750a/1750a.h: Likewise. * cppalloc.c: Likewise. * cppexp.c: Likewise. * cppfiles.c: Likewise. * cpphash.c: Likewise. * cpplib.c: Likewise. * dyn-string.c: Likewise. * fix-header.c: Likewise. * gcc.c: Likewise. * gcov.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * gencheck.c: Likewise. * gencodes.c: Likewise. * genconfig.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * gengenrtl.c: Likewise. * genopinit.c: Likewise. * genoutput.c: Likewise. * genpeep.c: Likewise. * genrecog.c: Likewise. * getpwd.c: Likewise. * halfpic.c: Likewise. * hash.c: Likewise. * mips-tdump.c: Likewise. Wrap malloc/realloc/calloc prototypes in NEED_DECLARATION_* macros. * mips-tfile.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. (fatal): Fix const-ification of variable `format' in !ANSI_PROTOTYPES case. * prefix.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. * print-rtl.c: Rename variable `spaces' to `xspaces' to avoid conflicting with function `spaces' from libiberty. * profile.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. * protoize.c: Likewise. * rtl.h: Likewise. * scan.h: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tree.h: Likewise. From-SVN: r23931
1998-11-27 11:09:17 +01:00
PTR
xmalloc (nbytes)
system.h: Include libiberty.h. * system.h: Include libiberty.h. * c-aux-info.c: Remove prototypes for concat/concat3. Change function `concat' from fixed parameters to variable parameters, as is done in libiberty. All callers of concat/concat3 changed to use the new `concat' with variable args. * cccp.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. * cexp.y: Likewise. * collect2.c: Likewise. * config/1750a/1750a.h: Likewise. * cppalloc.c: Likewise. * cppexp.c: Likewise. * cppfiles.c: Likewise. * cpphash.c: Likewise. * cpplib.c: Likewise. * dyn-string.c: Likewise. * fix-header.c: Likewise. * gcc.c: Likewise. * gcov.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * gencheck.c: Likewise. * gencodes.c: Likewise. * genconfig.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * gengenrtl.c: Likewise. * genopinit.c: Likewise. * genoutput.c: Likewise. * genpeep.c: Likewise. * genrecog.c: Likewise. * getpwd.c: Likewise. * halfpic.c: Likewise. * hash.c: Likewise. * mips-tdump.c: Likewise. Wrap malloc/realloc/calloc prototypes in NEED_DECLARATION_* macros. * mips-tfile.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. (fatal): Fix const-ification of variable `format' in !ANSI_PROTOTYPES case. * prefix.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. * print-rtl.c: Rename variable `spaces' to `xspaces' to avoid conflicting with function `spaces' from libiberty. * profile.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. * protoize.c: Likewise. * rtl.h: Likewise. * scan.h: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tree.h: Likewise. From-SVN: r23931
1998-11-27 11:09:17 +01:00
size_t nbytes;
{
register PTR tmp = (PTR) really_call_malloc (nbytes);
if (!tmp)
{
fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n",
nbytes);
exit (FATAL_EXIT_CODE);
}
return tmp;
}
#endif /* USE_C_ALLOCA */