Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6AAFECE58E for ; Tue, 15 Oct 2019 08:12:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B0F021835 for ; Tue, 15 Oct 2019 08:12:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728583AbfJOIMW (ORCPT ); Tue, 15 Oct 2019 04:12:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51965 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbfJOIMW (ORCPT ); Tue, 15 Oct 2019 04:12:22 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 18DC8801678; Tue, 15 Oct 2019 08:12:22 +0000 (UTC) Received: from thuth.remote.csb (ovpn-117-75.ams2.redhat.com [10.36.117.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B9655D6A9; Tue, 15 Oct 2019 08:12:19 +0000 (UTC) Subject: Re: [kvm-unit-tests PATCH 3/3] Makefile: use "-Werror" in cc-option To: Bill Wendling Cc: kvm list , Paolo Bonzini , Jim Mattson References: <20191010183506.129921-1-morbo@google.com> <20191010183506.129921-4-morbo@google.com> <67d3c72f-1537-7765-4b8c-d631859a3204@redhat.com> From: Thomas Huth Openpgp: preference=signencrypt Autocrypt: addr=thuth@redhat.com; prefer-encrypt=mutual; keydata= mQINBFH7eUwBEACzyOXKU+5Pcs6wNpKzrlJwzRl3VGZt95VCdb+FgoU9g11m7FWcOafrVRwU yYkTm9+7zBUc0sW5AuPGR/dp3pSLX/yFWsA/UB4nJsHqgDvDU7BImSeiTrnpMOTXb7Arw2a2 4CflIyFqjCpfDM4MuTmzTjXq4Uov1giGE9X6viNo1pxyEpd7PanlKNnf4PqEQp06X4IgUacW tSGj6Gcns1bCuHV8OPWLkf4hkRnu8hdL6i60Yxz4E6TqlrpxsfYwLXgEeswPHOA6Mn4Cso9O 0lewVYfFfsmokfAVMKWzOl1Sr0KGI5T9CpmRfAiSHpthhHWnECcJFwl72NTi6kUcUzG4se81 O6n9d/kTj7pzTmBdfwuOZ0YUSqcqs0W+l1NcASSYZQaDoD3/SLk+nqVeCBB4OnYOGhgmIHNW 0CwMRO/GK+20alxzk//V9GmIM2ACElbfF8+Uug3pqiHkVnKqM7W9/S1NH2qmxB6zMiJUHlTH gnVeZX0dgH27mzstcF786uPcdEqS0KJuxh2kk5IvUSL3Qn3ZgmgdxBMyCPciD/1cb7/Ahazr 3ThHQXSHXkH/aDXdfLsKVuwDzHLVSkdSnZdt5HHh75/NFHxwaTlydgfHmFFwodK8y/TjyiGZ zg2Kje38xnz8zKn9iesFBCcONXS7txENTzX0z80WKBhK+XSFJwARAQABtB5UaG9tYXMgSHV0 aCA8dGh1dGhAcmVkaGF0LmNvbT6JAjgEEwECACIFAlVgX6oCGwMGCwkIBwMCBhUIAgkKCwQW AgMBAh4BAheAAAoJEC7Z13T+cC21EbIP/ii9cvT2HHGbFRl8HqGT6+7Wkb+XLMqJBMAIGiQK QIP3xk1HPTsLfVG0ao4hy/oYkGNOP8+ubLnZen6Yq3zAFiMhQ44lvgigDYJo3Ve59gfe99KX EbtB+X95ODARkq0McR6OAsPNJ7gpEUzfkQUUJTXRDQXfG/FX303Gvk+YU0sp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k/CklvI7S9yoQje8BeQAHtdV cvO8XCLrpGuw9SgOS7OP5oI26a0548M4KldAY+kqX6XVphEw3/6U1KTf7WxW5zYLTtadjISB X9xsRWSU+Yqs3C7oN5TIPSoj9tXMoxZkCIHWvnqGwZ7JhwARAQABiQIfBBgBAgAJBQJR+3lM AhsMAAoJEC7Z13T+cC21hPAQAIsBL9MdGpdEpvXs9CYrBkd6tS9mbaSWj6XBDfA1AEdQkBOn ZH1Qt7HJesk+qNSnLv6+jP4VwqK5AFMrKJ6IjE7jqgzGxtcZnvSjeDGPF1h2CKZQPpTw890k fy18AvgFHkVk2Oylyexw3aOBsXg6ukN44vIFqPoc+YSU0+0QIdYJp/XFsgWxnFIMYwDpxSHS 5fdDxUjsk3UBHZx+IhFjs2siVZi5wnHIqM7eK9abr2cK2weInTBwXwqVWjsXZ4tq5+jQrwDK cvxIcwXdUTLGxc4/Z/VRH1PZSvfQxdxMGmNTGaXVNfdFZjm4fz0mz+OUi6AHC4CZpwnsliGV ODqwX8Y1zic9viSTbKS01ZNp175POyWViUk9qisPZB7ypfSIVSEULrL347qY/hm9ahhqmn17 Ng255syASv3ehvX7iwWDfzXbA0/TVaqwa1YIkec+/8miicV0zMP9siRcYQkyTqSzaTFBBmqD oiT+z+/E59qj/EKfyce3sbC9XLjXv3mHMrq1tKX4G7IJGnS989E/fg6crv6NHae9Ckm7+lSs IQu4bBP2GxiRQ+NV3iV/KU3ebMRzqIC//DCOxzQNFNJAKldPe/bKZMCxEqtVoRkuJtNdp/5a yXFZ6TfE1hGKrDBYAm4vrnZ4CXFSBDllL59cFFOJCkn4Xboj/aVxxJxF30bn Organization: Red Hat Message-ID: Date: Tue, 15 Oct 2019 10:12:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Tue, 15 Oct 2019 08:12:22 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 15/10/2019 09.57, Bill Wendling wrote: > On Tue, Oct 15, 2019 at 12:29 AM Thomas Huth wrote: >> >> On 10/10/2019 20.35, Bill Wendling wrote: >>> The "cc-option" macro should use "-Werror" to determine if a flag is >>> supported. Otherwise the test may not return a nonzero result. Also >>> conditionalize some of the warning flags which aren't supported by >>> clang. >>> >>> Signed-off-by: Bill Wendling >>> --- >>> Makefile | 19 +++++++++++-------- >>> 1 file changed, 11 insertions(+), 8 deletions(-) >>> >>> diff --git a/Makefile b/Makefile >>> index 32414dc..3ec0458 100644 >>> --- a/Makefile >>> +++ b/Makefile >>> @@ -46,30 +46,33 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile >>> # cc-option >>> # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) >>> >>> -cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ >>> +cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \ >>> > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) >>> >>> COMMON_CFLAGS += -g $(autodepend-flags) >>> -COMMON_CFLAGS += -Wall -Wwrite-strings -Wclobbered -Wempty-body -Wuninitialized >>> -COMMON_CFLAGS += -Wignored-qualifiers -Wunused-but-set-parameter >>> -COMMON_CFLAGS += -Werror >>> +COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized >>> +COMMON_CFLAGS += -Wignored-qualifiers -Werror >>> + >>> frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer >>> fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "") >>> fnostack_protector := $(call cc-option, -fno-stack-protector, "") >>> fnostack_protector_all := $(call cc-option, -fno-stack-protector-all, "") >>> -wno_frame_address := $(call cc-option, -Wno-frame-address, "") >>> fno_pic := $(call cc-option, -fno-pic, "") >>> no_pie := $(call cc-option, -no-pie, "") >>> COMMON_CFLAGS += $(fomit_frame_pointer) >>> COMMON_CFLAGS += $(fno_stack_protector) >>> COMMON_CFLAGS += $(fno_stack_protector_all) >>> -COMMON_CFLAGS += $(wno_frame_address) >>> COMMON_CFLAGS += $(if $(U32_LONG_FMT),-D__U32_LONG_FMT__,) >>> COMMON_CFLAGS += $(fno_pic) $(no_pie) >>> >>> +COMMON_CFLAGS += $(call cc-option, -Wno-frame-address, "") >> >> I think the old code used ":=" on purpose, so that the test is only done >> once. With your new code, the test is now done each time COMMON_CFLAGS >> gets evaluated, i.e. for each compiled object. >> >> Could you please rewrite this test to use the ":=" detour for all lines >> that call cc-option? >> > Does it rerun the "cc-option" call if the COMMON_CFLAGS is initially > defined with ":="? It does not rerun the "cc-option" call in that case, but compilation fails. I think it's likely due to the line that contains the "$(if $(U32_LONG_FMT),-D__U32_LONG_FMT__,)" since that likely needs to be evaluated dynamically. Thomas