X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fgenextract.c;h=09e7cde838018ef5baf70343485db4f90dbefe29;hb=13a61b19edc44dd9bcfc8860972622816d7eefe8;hp=2631e2adfe3bdf39e9fe2e94335b4a075faa797d;hpb=8c4c00c181e6df4f0a9afc76e4c9edbbc1c2fd41;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/genextract.c b/gcc/genextract.c index 2631e2adfe3..09e7cde8380 100644 --- a/gcc/genextract.c +++ b/gcc/genextract.c @@ -1,6 +1,6 @@ /* Generate code from machine description to extract operands from insn as rtl. Copyright (C) 1987, 1991, 1992, 1993, 1997, 1998, 1999, 2000, 2003, - 2004, 2005, 2007 + 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see #include "tm.h" #include "rtl.h" #include "errors.h" +#include "read-md.h" #include "gensupport.h" #include "vec.h" #include "vecprim.h" @@ -80,6 +81,8 @@ struct accum_extract VEC(char,heap) *pathstr; }; +int line_no; + /* Forward declarations. */ static void walk_rtx (rtx, struct accum_extract *); @@ -152,7 +155,7 @@ gen_insn (rtx insn, int insn_code_number) /* Otherwise, make a new extraction method. We stash the arrays after the extraction structure in memory. */ - p = xmalloc (sizeof (struct extraction) + p = XNEWVAR (struct extraction, sizeof (struct extraction) + op_count*sizeof (char *) + dup_count*sizeof (char *) + dup_count*sizeof (int)); @@ -187,8 +190,13 @@ VEC_safe_set_locstr (VEC(locstr,heap) **vp, unsigned int ix, char *str) { if (ix < VEC_length (locstr, *vp)) { - gcc_assert (VEC_index (locstr, *vp, ix) == 0); - VEC_replace (locstr, *vp, ix, str); + if (VEC_index (locstr, *vp, ix)) + { + message_with_line (line_no, "repeated operand number %d", ix); + have_error = 1; + } + else + VEC_replace (locstr, *vp, ix, str); } else { @@ -357,7 +365,7 @@ print_header (void) #include \"rtl.h\"\n\ #include \"insn-config.h\"\n\ #include \"recog.h\"\n\ -#include \"toplev.h\"\n\ +#include \"diagnostic-core.h\"\n\ \n\ /* This variable is used as the \"location\" of any missing operand\n\ whose numbers are skipped by a given pattern. */\n\ @@ -399,11 +407,10 @@ main (int argc, char **argv) struct code_ptr *link; const char *name; int insn_code_number; - int line_no; progname = "genextract"; - if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE) + if (!init_rtx_reader_args (argc, argv)) return (FATAL_EXIT_CODE); /* Read the machine description. */ @@ -423,6 +430,9 @@ main (int argc, char **argv) } } + if (have_error) + return FATAL_EXIT_CODE; + print_header (); /* Write out code to handle peepholes and the insn_codes that it should