From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPTRw-0007jK-Bg for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:35:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPTRp-0006gB-SG for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:35:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPTRp-0006g6-KL for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:35:21 -0400 Date: Thu, 4 Sep 2014 11:35:18 +0200 From: Igor Mammedov Message-ID: <20140904113518.7724ffa3@nial.usersys.redhat.com> In-Reply-To: <1408652576-30878-1-git-send-email-ehabkost@redhat.com> References: <1408652576-30878-1-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-i386: Reject invalid CPU feature names on the command-line List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Paolo Bonzini , qemu-devel@nongnu.org, Andreas =?ISO-8859-1?B?RuRyYmVy?= On Thu, 21 Aug 2014 17:22:56 -0300 Eduardo Habkost wrote: > Instead of simply printing a warning, report an error when invalid CPU > options are provided on the CPU model string. > > Signed-off-by: Eduardo Habkost Reviewed-By: Igor Mammedov > --- > target-i386/cpu.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 217500c..c27b24a 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -592,7 +592,8 @@ static bool lookup_feature(uint32_t *pval, const char *s, const char *e, > } > > static void add_flagname_to_bitmaps(const char *flagname, > - FeatureWordArray words) > + FeatureWordArray words, > + Error **errp) > { > FeatureWord w; > for (w = 0; w < FEATURE_WORDS; w++) { > @@ -603,7 +604,7 @@ static void add_flagname_to_bitmaps(const char *flagname, > } > } > if (w == FEATURE_WORDS) { > - fprintf(stderr, "CPU feature %s not found\n", flagname); > + error_setg(errp, "CPU feature %s not found", flagname); > } > } > > @@ -1761,9 +1762,9 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features, > while (featurestr) { > char *val; > if (featurestr[0] == '+') { > - add_flagname_to_bitmaps(featurestr + 1, plus_features); > + add_flagname_to_bitmaps(featurestr + 1, plus_features, &local_err); > } else if (featurestr[0] == '-') { > - add_flagname_to_bitmaps(featurestr + 1, minus_features); > + add_flagname_to_bitmaps(featurestr + 1, minus_features, &local_err); > } else if ((val = strchr(featurestr, '='))) { > *val = 0; val++; > feat2prop(featurestr);