From: Thomas Huth Subject: Re: [kvm-unit-tests v2 PATCH 2/3] Replace -Wextra with a saner list of warning flags Date: Fri, 30 Jun 2017 11:09:58 +0200 Message-ID: <36bd8421-ee33-d75b-e1a4-4c10aff5ac03@redhat.com> References: <1498761773-11164-1-git-send-email-thuth@redhat.com> <1498761773-11164-3-git-send-email-thuth@redhat.com> <20170630081922.6e7u5mgc4chqnkpt@kamzik.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Paolo Bonzini , David Hildenbrand , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Laurent Vivier To: Andrew Jones Return-path: Received: from mx1.redhat.com ([209.132.183.28]:41530 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751659AbdF3JKK (ORCPT ); Fri, 30 Jun 2017 05:10:10 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E862D6B222 for ; Fri, 30 Jun 2017 09:10:09 +0000 (UTC) In-Reply-To: <20170630081922.6e7u5mgc4chqnkpt@kamzik.brq.redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 30.06.2017 10:19, Andrew Jones wrote: > On Thu, Jun 29, 2017 at 08:42:52PM +0200, Thomas Huth wrote: >> Using -Wextra together with -Werror is troublesome - various versions >> of GCC produce suspicious or even wrong warnings with -Wextra which >> then become fatal errors with -Werror. For example, the current state >> of the kvm-unit-tests does not compile anymore with GCC 4.8.1 for >> s390x due to an inadequate -Wmissing-field-initializers warning. >> That's annoying for users who just would like to compile the >> kvm-unit-tests and cumbersome for the developers who have to work >> around these problems in the source code. So let's replace -Wextra >> by a saner lists of warning flags that are normally enabled by -Wextra. >> Since they apparently can be used for building x86, too, the flags >> are now also applied to the global CFLAGS instead of specifying them >> for the single targets only. >> >> Signed-off-by: Thomas Huth >> --- >> v2: >> - Now that we've got COMMON_CFLAGS, the remaining flags can be >> added to the global CFLAGS, too >> - Removed -Wsign-compare > > I was just doing some reading about warning types. It looks like > -Wsign-compare comes with -Wall anyway. According to https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html it's only enabled by -Wall when you're compiling a C++ file, for plain C it is only enabled by -Wextra. Thomas