From patchwork Fri Jan 27 17:20:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 138256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id DF9F6B6F6F for ; Sat, 28 Jan 2012 04:21:19 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1328289681; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=BwXOgy2 0zdXOfY0Xb6DPamz6db8=; b=mPRmLgS9FP/nbI0FPsmyOYFmpznaRUa+Td/hzCg KURMv0bt8NOfbS/MVFFSKFbNaIX1RPVAR6iwxzJKht/X6tTMRsuH6goX1TrKZRGs s10kq/FQUAxOGtk77cX6nt3eirom5zApbAY+8pmno1/tmz1qlHEsdqEEHbQbIsTp t8ig= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=pDY9XB+0IAbRimbwEHEN6KLYTOGrCKxSmC7I+bARdL7VXKnUKz/L+LAjJcVcCo fJGXSuw0WStILJ6pozfR/MiB3+FofEJ+z/bP+KUe8xk36IVrYJI9VcC77kWLic/V XHICDYqddi85wIJLj0YK87Kqz0F3qs4n9HZazMQvRIZDQ=; Received: (qmail 24773 invoked by alias); 27 Jan 2012 17:21:14 -0000 Received: (qmail 24764 invoked by uid 22791); 27 Jan 2012 17:21:12 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL, BAYES_00, FROM_12LTRDOM X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 Jan 2012 17:20:59 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1RqpTh-0003gk-Oy from Bernd_Schmidt@mentor.com for gcc-patches@gcc.gnu.org; Fri, 27 Jan 2012 09:20:45 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 27 Jan 2012 09:20:43 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Fri, 27 Jan 2012 17:20:43 +0000 Message-ID: <4F22DCE9.4010701@codesourcery.com> Date: Fri, 27 Jan 2012 18:20:41 +0100 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20) Gecko/20110920 Lightning/1.0b3pre Thunderbird/3.1.12 MIME-Version: 1.0 To: GCC Patches Subject: Fix genautomata option parsing Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org I noticed that genautomata does not accept any of the options it is trying to handle, since init_rtx_reader_args already errors out for all of them. This was probably broken by some gensupport reorganization way back. Fixed with this patch; I also removed the zero initializations for the flags which ought to be unnecessary. Bootstrapped on i686-linux. Ok? Bernd * genautomata.c (parse_automata_opt): New static function. (initiate_automaton_gen): Remove all option handling code. Remove argc argument. All callers changed. (main): Call init_rtx_reader_args_cb with the new function as argument. Index: gcc/genautomata.c =================================================================== --- gcc/genautomata.c (revision 182544) +++ gcc/genautomata.c (working copy) @@ -9285,46 +9285,45 @@ base_file_name (const char *file_name) return file_name + directory_name_length + 1; } +/* A function passed as argument to init_rtx_reader_args_cb. It parses the + options available for genautomata. Returns true if the option was + recognized. */ +static bool +parse_automata_opt (const char *str) +{ + if (strcmp (str, NO_MINIMIZATION_OPTION) == 0) + no_minimization_flag = 1; + else if (strcmp (str, TIME_OPTION) == 0) + time_flag = 1; + else if (strcmp (str, STATS_OPTION) == 0) + stats_flag = 1; + else if (strcmp (str, V_OPTION) == 0) + v_flag = 1; + else if (strcmp (str, W_OPTION) == 0) + w_flag = 1; + else if (strcmp (str, NDFA_OPTION) == 0) + ndfa_flag = 1; + else if (strcmp (str, COLLAPSE_OPTION) == 0) + collapse_flag = 1; + else if (strcmp (str, PROGRESS_OPTION) == 0) + progress_flag = 1; + else if (strcmp (str, "-split") == 0) + { + fatal ("option `-split' has not been implemented yet\n"); + /* split_argument = atoi (argument_vect [i + 1]); */ + } + else + return false; + + return true; +} + /* The following is top level function to initialize the work of pipeline hazards description translator. */ static void -initiate_automaton_gen (int argc, char **argv) +initiate_automaton_gen (char **argv) { const char *base_name; - int i; - - ndfa_flag = 0; - split_argument = 0; /* default value */ - no_minimization_flag = 0; - time_flag = 0; - stats_flag = 0; - v_flag = 0; - w_flag = 0; - progress_flag = 0; - for (i = 2; i < argc; i++) - if (strcmp (argv [i], NO_MINIMIZATION_OPTION) == 0) - no_minimization_flag = 1; - else if (strcmp (argv [i], TIME_OPTION) == 0) - time_flag = 1; - else if (strcmp (argv [i], STATS_OPTION) == 0) - stats_flag = 1; - else if (strcmp (argv [i], V_OPTION) == 0) - v_flag = 1; - else if (strcmp (argv [i], W_OPTION) == 0) - w_flag = 1; - else if (strcmp (argv [i], NDFA_OPTION) == 0) - ndfa_flag = 1; - else if (strcmp (argv [i], COLLAPSE_OPTION) == 0) - collapse_flag = 1; - else if (strcmp (argv [i], PROGRESS_OPTION) == 0) - progress_flag = 1; - else if (strcmp (argv [i], "-split") == 0) - { - if (i + 1 >= argc) - fatal ("-split has no argument."); - fatal ("option `-split' has not been implemented yet\n"); - /* split_argument = atoi (argument_vect [i + 1]); */ - } /* Initialize IR storage. */ obstack_init (&irp); @@ -9620,10 +9619,10 @@ main (int argc, char **argv) progname = "genautomata"; - if (!init_rtx_reader_args (argc, argv)) + if (!init_rtx_reader_args_cb (argc, argv, parse_automata_opt)) return (FATAL_EXIT_CODE); - initiate_automaton_gen (argc, argv); + initiate_automaton_gen (argv); while (1) { int lineno;