From patchwork Mon Oct 14 19:24:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Wendling X-Patchwork-Id: 11189347 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8032914DB for ; Mon, 14 Oct 2019 19:24:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 57DBF21721 for ; Mon, 14 Oct 2019 19:24:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pKZBHc1s" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388698AbfJNTYl (ORCPT ); Mon, 14 Oct 2019 15:24:41 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:32784 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388526AbfJNTYl (ORCPT ); Mon, 14 Oct 2019 15:24:41 -0400 Received: by mail-pf1-f202.google.com with SMTP id z4so14060799pfn.0 for ; Mon, 14 Oct 2019 12:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=XTuI7th3+9dwO3nKtBiY4qgOMbcjEb2zppHYOAbpHRc=; b=pKZBHc1sL0Aihc9J58KstqL1tdK75TYWZt7T71dQgixvTRjPWy9eR23YCkK01QQJPB R5KoV9l0kqeqeBua/Z4Qdf+BuSOSU14p/a7aMs2abKFLIbttKmOY5UwaSPSPgrGpfIp3 d/cnBJgGdm+w47On2ZNxE5ANbC2gVOKM8Huh3JlTMV+34cpcn1OCVZcd+ggU5cmA5xjs vGDi3M1x6uv53yUXXqSOQhl4yC6QSQOqeHSHJBTElArrpVa5p82ru3AtNpjdB3EYbCzN cPLrQnUuTD68SaxxmPD8FrfmhyQIlbSDPO6WZrbcVLRX6x6DpEPNsfxE3XQCd9Z++jpE w9YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=XTuI7th3+9dwO3nKtBiY4qgOMbcjEb2zppHYOAbpHRc=; b=WOjSIWoAIDloPSjXReMQ4eNm9KyYnXD8rFgtAEcEOvDyfux4P8DEsDUzdCPOIyhPiT KAqjT2kf1T7s9X2+jC31t1258Fn/s3fDQbHYPDp0FUvVOTT/T6iPinlb9jblu+r1ddYp W1FB25V17WIxC1p+eN27QjBvCUjmBjIocMkems7pYrkpjfBNYoNEeo5u0giCh33y2kSf DdXO/KjWepVa6d/6Jou68dE5lM4KFeM73GfkbK3y+Zi/CaBtKQp7GVZ8ESc2uoKx39Dx CZRiyxxKS32+48O+OCh3ucZXk4FswYXtJX6JGUwEQSVEPxVaekL6vsgjFtbFP/wpRJgA FVbQ== X-Gm-Message-State: APjAAAXWFocgWlVM7g184AESWNOTryMa8Pa4zNcbfkGOnIOk//hmWe7x qq3h/N2AqUH1mYZ8dD4pQJky8cphIzvvUiFHFYXn3jXWzEdCAtbw2P6+i/Cr6qGWwvWpxk2wjhC 8qLgNIR9OD5Czym6TyuLyqhiKe03kAjXpR6CuvJKoIfSOtLwScm6ncA== X-Google-Smtp-Source: APXvYqxCB2n5bex1Ri2jT7GzX+W5F0ZSg6NXeJUsVz8u3rrbkJVfjA+XO97PtqaauyILz5uDxV2w/LEHCA== X-Received: by 2002:a65:4c03:: with SMTP id u3mr34809021pgq.440.1571081080141; Mon, 14 Oct 2019 12:24:40 -0700 (PDT) Date: Mon, 14 Oct 2019 12:24:28 -0700 In-Reply-To: <20191014192431.137719-1-morbo@google.com> Message-Id: <20191014192431.137719-2-morbo@google.com> Mime-Version: 1.0 References: <20191010183506.129921-1-morbo@google.com> <20191014192431.137719-1-morbo@google.com> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb-goog Subject: [kvm-unit-tests PATCH 1/4] x86: emulator: use "SSE2" for the target From: Bill Wendling To: kvm@vger.kernel.org, pbonzini@redhat.com Cc: jmattson@google.com, sean.j.christopherson@intel.com, Bill Wendling Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The movdqu and movapd instructions are SSE2 instructions. Clang interprets the __attribute__((target("sse"))) as allowing SSE only instructions. Using SSE2 instructions cause an error. Signed-off-by: Bill Wendling --- x86/emulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86/emulator.c b/x86/emulator.c index 621caf9..bec0154 100644 --- a/x86/emulator.c +++ b/x86/emulator.c @@ -657,7 +657,7 @@ static bool sseeq(sse_union *v1, sse_union *v2) return ok; } -static __attribute__((target("sse"))) void test_sse(sse_union *mem) +static __attribute__((target("sse2"))) void test_sse(sse_union *mem) { sse_union v; From patchwork Mon Oct 14 19:24:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Wendling X-Patchwork-Id: 11189351 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1187876 for ; Mon, 14 Oct 2019 19:24:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD606217F9 for ; Mon, 14 Oct 2019 19:24:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lwj86rm0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388538AbfJNTYo (ORCPT ); Mon, 14 Oct 2019 15:24:44 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:39017 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388382AbfJNTYn (ORCPT ); Mon, 14 Oct 2019 15:24:43 -0400 Received: by mail-pg1-f202.google.com with SMTP id m20so13307205pgv.6 for ; Mon, 14 Oct 2019 12:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=hn+keZB9xpauOPEG/xtppgt0f+LdcfGzJGEyhk0ef1U=; b=lwj86rm0uccYhiSW4u10l6kRCUc2PCwgclMCQgKsnRGxhzCHI5Ku5lYH6ExaiYSnHZ kdvMgz2d7YHlXU6zjnDaMTCodjh68xBp4qPOWTghqpBuLLSLuIk17PmFTaLnpEz+XAmk +ZFxnN/sxpqDttc0ifsFW2p4N/+XfQm09WEucdomHZ2F0vTbmisO1fkN1ZvsFvQF5j3E mLWeFb8JdSg9WIRPreWbIwEZ7FbZwAqyb0y6Sa91JYSOeKBMMzMjkn5BFaU/ZX1NB78F QugSJ5NkMza87+vVO+OMME9LnhMl/fwrwf2TgXReFWcjFLSJkk2QO8Gf3A9JQs6dCrRq ndPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=hn+keZB9xpauOPEG/xtppgt0f+LdcfGzJGEyhk0ef1U=; b=hrZZ4MnC3s5GFaafR9lnsrEuB1wNTXKd7ZzUO0/IkY90SP/M1AcG+JBHNWWeEo+xLE vrAoUF1SkI+rtBtDFOiZ0RyVh7cYlHf3Ba2frDBcazyoOiwROs/XRSobvUdlv9W59RhN E+pnJJNFsf2cPmqxgaUZIBEj5ukxzuSmQPuyNhDwaMvEHFNHwH/Nyt7nwWI4YGS6QgRQ ctz+SqfCi69GxYyDbYDJB5cXo2Qp6HW4/pMMw017rmzuA/zqGonXCss0yyYaIp/KwIKG k5zp4expQceerIBavZHNJwv3EFIlERKWPXTNUMGgku1KM1r6QXV4qtWPn1do3oLt9p8L V7zA== X-Gm-Message-State: APjAAAVGe4821iuDh2Pm17niOTdqlukP3PT4FQ7YXjoVQqh8YA8O6/33 1NUi7Uoe4tlyTT77T7DdVlGwxRQ6CA5gcw3RyEsmXTq3mGdQLCrcAFx83WeON87WDUZEZTe38hd bDoz9FrGPAIIZ3t6KvROTJWhlk0C15nV5sbvSp5qlPQwDU1fIHEvnkw== X-Google-Smtp-Source: APXvYqxrjaJ0JS+qAa243k3bncIbFYsGj4RS4WUEL6LzJT2tBjeSCGK5g0QUJpTlSGZ2PjmMnrQGOgbCWg== X-Received: by 2002:a63:d415:: with SMTP id a21mr33243571pgh.299.1571081082890; Mon, 14 Oct 2019 12:24:42 -0700 (PDT) Date: Mon, 14 Oct 2019 12:24:29 -0700 In-Reply-To: <20191014192431.137719-1-morbo@google.com> Message-Id: <20191014192431.137719-3-morbo@google.com> Mime-Version: 1.0 References: <20191010183506.129921-1-morbo@google.com> <20191014192431.137719-1-morbo@google.com> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb-goog Subject: [kvm-unit-tests PATCH 2/4] pci: cast the masks to the appropriate size From: Bill Wendling To: kvm@vger.kernel.org, pbonzini@redhat.com Cc: jmattson@google.com, sean.j.christopherson@intel.com, Bill Wendling Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org At this point, we're dealing with 32-bit addresses, therefore downcast the masks to 32-bits. Signed-off-by: Bill Wendling --- lib/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pci.c b/lib/pci.c index daa33e1..1b85411 100644 --- a/lib/pci.c +++ b/lib/pci.c @@ -107,7 +107,8 @@ pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id) uint32_t pci_bar_mask(uint32_t bar) { return (bar & PCI_BASE_ADDRESS_SPACE_IO) ? - PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK; + (uint32_t)PCI_BASE_ADDRESS_IO_MASK : + (uint32_t)PCI_BASE_ADDRESS_MEM_MASK; } uint32_t pci_bar_get(struct pci_dev *dev, int bar_num) From patchwork Mon Oct 14 19:24:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Wendling X-Patchwork-Id: 11189353 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5A5E1390 for ; Mon, 14 Oct 2019 19:24:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B731B217F9 for ; Mon, 14 Oct 2019 19:24:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WAhc65Cr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388810AbfJNTYr (ORCPT ); Mon, 14 Oct 2019 15:24:47 -0400 Received: from mail-pg1-f201.google.com ([209.85.215.201]:55182 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388752AbfJNTYq (ORCPT ); Mon, 14 Oct 2019 15:24:46 -0400 Received: by mail-pg1-f201.google.com with SMTP id b26so449142pgn.21 for ; Mon, 14 Oct 2019 12:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=Vc8OTlhGfb05aXJfWu7AtqIcU+fGPGUvUYZpoXjMLmQ=; b=WAhc65CrQxShRPul30U/irwJc3Xv36N36CE0d5N4KpETUO4S1OFMwPgu/Yjr8gqPgX LGZ7BqpQ/HYhHbUW9Ws+i+wn6jZXLeZOGqdLL6HPGGgqW2bWGtvZxE7VD4pda2X90OTA 8VNGhH0xV/YA1clyM2jQLx9KU69Bbp+0Tjj0Imdbwc0ftn8iPbBk3MJNSvXqKeVK+XFn 6m1IJjIsMX27RLoEK2KBkWOq2T36IwPE4mqzrlhmXOMKLV2HGFbuG/nvjX6rdefSpABw 5LgdVKmzJ+S/6roI/8EjLg2odLZbczFZ6NeOw0XoLMBojHbWpEZyYVcgI+HAJ9amS6q7 sWlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Vc8OTlhGfb05aXJfWu7AtqIcU+fGPGUvUYZpoXjMLmQ=; b=GFXyEbX1FCRPqQLU6ZnUGDWkO1seVITEjfzTVaRTFlmn73IMH8XhEY7wBumWEYZAoP aXkaFYF1pVPJngr9Os7sqa8lMurhMPY/2HjSQ4m3kqqVZocelswwoKN51UroGxw/UNGI fJ65PcZBeqatpJTQCv0VqV7FHZY3rZAvN/lBpwayGZG3VkC4q0BiKWvgPeVVo+udApyl eBnRIHne+UPN2R29afUK8R6DEaDKIpPXG6X1hRIQjYIxgV72deY7hjBmQ34llFYhDsW6 BQRTL2X9ak/uPS/ie8XW10/D5WkCbVAcIJypqcaZChieNj7cbiHGs3+hayyqKRPqel3O vakw== X-Gm-Message-State: APjAAAWddhb5duWLAYjPfDnCqLBbJL60u2Sd4m544NZTrfPLiDf8zKo8 JSoi9ovvACU6KLIczFrOf1zGS6MYpjMCLKcibAEA+OOJ8JRZSS3tvT6Cl9JwcjvRKyrlDGHPvsO ojD4/FaPVeAbuy7UfwRN9e6wMAlg9dhq1lnFBFsShwhwyjKRQa8Xv8g== X-Google-Smtp-Source: APXvYqxmquaVcN6XavAqx3SmG7R4thfdgwuuEYR3oURjqm0+Glwwod+M/kvJvj/1vCXZekq5iSjw/bHPEw== X-Received: by 2002:a63:fb52:: with SMTP id w18mr13708493pgj.251.1571081085810; Mon, 14 Oct 2019 12:24:45 -0700 (PDT) Date: Mon, 14 Oct 2019 12:24:30 -0700 In-Reply-To: <20191014192431.137719-1-morbo@google.com> Message-Id: <20191014192431.137719-4-morbo@google.com> Mime-Version: 1.0 References: <20191010183506.129921-1-morbo@google.com> <20191014192431.137719-1-morbo@google.com> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb-goog Subject: [kvm-unit-tests PATCH 3/4] Makefile: use "-Werror" in cc-option From: Bill Wendling To: kvm@vger.kernel.org, pbonzini@redhat.com Cc: jmattson@google.com, sean.j.christopherson@intel.com, Bill Wendling Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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, "") +COMMON_CFLAGS += $(call cc-option, -Wclobbered, "") +COMMON_CFLAGS += $(call cc-option, -Wunused-but-set-parameter, "") +COMMON_CFLAGS += $(call cc-option, -Wmissing-parameter-type, "") +COMMON_CFLAGS += $(call cc-option, -Wold-style-declaration, "") + CFLAGS += $(COMMON_CFLAGS) -CFLAGS += -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -CFLAGS += -Wmissing-prototypes -Wstrict-prototypes +CFLAGS += -Woverride-init -Wmissing-prototypes -Wstrict-prototypes CXXFLAGS += $(COMMON_CFLAGS) From patchwork Mon Oct 14 19:24:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Wendling X-Patchwork-Id: 11189355 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14DA81390 for ; Mon, 14 Oct 2019 19:24:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E955721721 for ; Mon, 14 Oct 2019 19:24:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Q+GyopSR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388822AbfJNTYu (ORCPT ); Mon, 14 Oct 2019 15:24:50 -0400 Received: from mail-pg1-f201.google.com ([209.85.215.201]:48116 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388245AbfJNTYt (ORCPT ); Mon, 14 Oct 2019 15:24:49 -0400 Received: by mail-pg1-f201.google.com with SMTP id 186so13284762pgd.14 for ; Mon, 14 Oct 2019 12:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=/epx1jtpSVt829SAvdwTHPwrDv7PHVQvxA/5Eb/brYE=; b=Q+GyopSRyzNJiq+p1q1++mIASjq7d4BnNQiuWYmLgpwfOpsBE8NAaq7mZ2H5/PXpml Gc6+Bzxc8SVANaM5EqQdDsl2ZFgxbdbed8tR4oIm4/V7LsJtmqP1lxW8Jp+6QLNmGsK/ C2uv6E8Eb9RhAA+k7tXktTkAyFtGocB94/av2VVHD/7UGTXnDm125mqCt1tVTKGQJMBz lQDtt8iiuXPyuJ+nDUIhYwo7y9b/mcNG0tec7ORVGzro/PzCJQqfhTC2aM6pEkMySXjE MjHJszK2I03AW/0bSjLtTukhog9+hkFXUGBf0L2EFsjJJm3+58PZv0WAKHdoYg35A13V y+pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=/epx1jtpSVt829SAvdwTHPwrDv7PHVQvxA/5Eb/brYE=; b=PRCZmYNRGDpj9f4MtQChGP5m8F3HPX2cHZ9P2pMGjwNMj/RmqSoXZ4yk0IexESOIXT p0ge1Q+NHESGfsEgUA//wWE0tV0SyFbuO8g0MWSuFcKbtdxQd0hdKfUBhjHMyEqGtBW+ uPNS806KrgcZxDSBCEGC3LzHo4WSvNDYfcMmOoGwordXnrqIDONX39VnIabxIPPj/1fq ahSUQqG5O+nBjTtnVldvcDr5mGqub5AuX9ladBdEpO3FYVU3JPkOa6vBSOjmzvAgfTLC v1+Xda4ObQFEI6Nc9vjcUM1NokkdRlPnCezZDyZdHZRP5ZD2n1ijEpCXV+OIOU8MhnSW lPqQ== X-Gm-Message-State: APjAAAVdBsK9p+vVfU22xlX3pYCqLU+DVC4JhrPVr4YaQP+1LWiGp2Nd 6wWXD77gXhaosZEgPL4qRdeXt0RsgRK7+d+N9PuNlZ0erR/2YqtWrjhcSYgZrndqwzk3Dow2YS8 ibkVXBUXTFqJNyEnN2cgrlarCCeRVOJ7byiXtTJr/BcPoXJ4XmWBGbA== X-Google-Smtp-Source: APXvYqySkBLQF86YkEN1ryNEaPuCf/DFkeq2NO0VH8CXmxfyx21NvDZhwrvw2ozfZ3YRUKIuocNlX9uZdA== X-Received: by 2002:a63:f904:: with SMTP id h4mr7072165pgi.80.1571081088929; Mon, 14 Oct 2019 12:24:48 -0700 (PDT) Date: Mon, 14 Oct 2019 12:24:31 -0700 In-Reply-To: <20191014192431.137719-1-morbo@google.com> Message-Id: <20191014192431.137719-5-morbo@google.com> Mime-Version: 1.0 References: <20191010183506.129921-1-morbo@google.com> <20191014192431.137719-1-morbo@google.com> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb-goog Subject: [kvm-unit-tests PATCH 4/4] Makefile: add "cxx-option" for C++ builds From: Bill Wendling To: kvm@vger.kernel.org, pbonzini@redhat.com Cc: jmattson@google.com, sean.j.christopherson@intel.com, Bill Wendling Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The C++ compiler may not support all of the same flags as the C compiler. Add a separate test for these flags. Signed-off-by: Bill Wendling --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3ec0458..b9ae791 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,8 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile 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 ;) +cxx-option = $(shell if $(CXX) -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 -Wempty-body -Wuninitialized @@ -68,13 +70,15 @@ COMMON_CFLAGS += $(fno_pic) $(no_pie) COMMON_CFLAGS += $(call cc-option, -Wno-frame-address, "") COMMON_CFLAGS += $(call cc-option, -Wclobbered, "") COMMON_CFLAGS += $(call cc-option, -Wunused-but-set-parameter, "") -COMMON_CFLAGS += $(call cc-option, -Wmissing-parameter-type, "") -COMMON_CFLAGS += $(call cc-option, -Wold-style-declaration, "") CFLAGS += $(COMMON_CFLAGS) +CFLAGS += $(call cc-option, -Wmissing-parameter-type, "") +CFLAGS += $(call cc-option, -Wold-style-declaration, "") CFLAGS += -Woverride-init -Wmissing-prototypes -Wstrict-prototypes CXXFLAGS += $(COMMON_CFLAGS) +CXXFLAGS += $(call cxx-option, -Wmissing-parameter-type, "") +CXXFLAGS += $(call cxx-option, -Wold-style-declaration, "") autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d