From patchwork Mon Feb 28 10:22:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 84770 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 F1FB9B7145 for ; Mon, 28 Feb 2011 21:22:54 +1100 (EST) Received: (qmail 16941 invoked by alias); 28 Feb 2011 10:22:49 -0000 Received: (qmail 16932 invoked by uid 22791); 28 Feb 2011 10:22:48 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mo-p00-ob.rzone.de (HELO mo-p00-ob.rzone.de) (81.169.146.162) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Feb 2011 10:22:43 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT2k715jHQaJercGObUOFkj18odoYNahU4Q== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.22] (business-188-111-022-002.static.arcor-ip.net [188.111.22.2]) by post.strato.de (klopstock mo6) (RZmta 25.5) with ESMTPA id z0653cn1SA4I3a ; Mon, 28 Feb 2011 11:22:33 +0100 (MET) Message-ID: <4D6B7769.9090803@gjlay.de> Date: Mon, 28 Feb 2011 11:22:33 +0100 From: Georg-Johann Lay User-Agent: Thunderbird 2.0.0.24 (X11/20100302) MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org CC: Anatoly Sokolov , Eric Weddington , Denis Chertykov Subject: Re: [Patch, AVR, 4.5] Fix PR45261: gcc does not indicate failure status on unsupported MCU References: <4D651030.7070003@gjlay.de> In-Reply-To: <4D651030.7070003@gjlay.de> X-IsSubscribed: yes 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 This is a backport to gcc-4.5-branch to fix PR45261 2011-02-28 Georg-Johann Lay PR target/45261 * config/avr/avr.c (avr_option_override): Use error on bad options. (avr_help): New function. (TARGET_HELP): Define. Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 170557) +++ config/avr/avr.c (working copy) @@ -91,6 +91,7 @@ static bool avr_hard_regno_scratch_ok (u static unsigned int avr_case_values_threshold (void); static bool avr_frame_pointer_required_p (void); static bool avr_can_eliminate (const int, const int); +static void avr_help (void); /* Allocate registers from r25 to r8 for parameters for function calls. */ #define FIRST_CUM_REG 26 @@ -192,6 +193,9 @@ static const struct attribute_spec avr_a #undef TARGET_CAN_ELIMINATE #define TARGET_CAN_ELIMINATE avr_can_eliminate +#undef TARGET_HELP +#define TARGET_HELP avr_help + struct gcc_target targetm = TARGET_INITIALIZER; void @@ -207,10 +211,8 @@ avr_override_options (void) if (!t->name) { - fprintf (stderr, "unknown MCU '%s' specified\nKnown MCU names:\n", - avr_mcu_name); - for (t = avr_mcu_types; t->name; t++) - fprintf (stderr," %s\n", t->name); + error ("unrecognized argument to -mmcu= option: %qs", avr_mcu_name); + inform (input_location, "See --target-help for supported MCUs"); } avr_current_device = t; @@ -223,6 +225,42 @@ avr_override_options (void) init_machine_status = avr_init_machine_status; } +/* Implement TARGET_HELP */ +/* Report extra information for --target-help */ + +static void +avr_help (void) +{ + const struct mcu_type_s *t; + const char * const indent = " "; + int len; + + /* Give a list of MCUs that are accepted by -mmcu=* . + Note that MCUs supported by the compiler might differ from + MCUs supported by binutils. */ + + len = strlen (indent); + printf ("Known MCU names:\n%s", indent); + + /* Print a blank-separated list of all supported MCUs */ + + for (t = avr_mcu_types; t->name; t++) + { + printf ("%s ", t->name); + len += 1 + strlen (t->name); + + /* Break long lines */ + + if (len > 66 && (t+1)->name) + { + printf ("\n%s", indent); + len = strlen (indent); + } + } + + printf ("\n\n"); +} + /* return register class from register number. */ static const enum reg_class reg_class_tab[]={