From patchwork Tue Oct 15 00:04:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Wendling X-Patchwork-Id: 11189523 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 A88C417E6 for ; Tue, 15 Oct 2019 00:04:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86B4B217F9 for ; Tue, 15 Oct 2019 00:04:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AfQKpBPq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726876AbfJOAEV (ORCPT ); Mon, 14 Oct 2019 20:04:21 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:35913 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726866AbfJOAEV (ORCPT ); Mon, 14 Oct 2019 20:04:21 -0400 Received: by mail-pg1-f202.google.com with SMTP id h36so13764800pgb.3 for ; Mon, 14 Oct 2019 17:04:19 -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=AfQKpBPqVxVR2G3jH4Mlo8pegG6UJSeiv7z9GCBcry/fq3zmZ8zQUloTMGWfrhsl3M cvnYmJrwRmhPxuar7QmF+nJE3I5oOtjaFeecMtaxJ62DPuDf7Zwqt9uNt/7A9H2jPjf6 nQjCJsGuHzjBav5o0KrOaHl0rGV+Lp67Teo+MFmDXyUx0vZ9+LeD5tqkUYZiEcrUfa/C YQQMEhutnU8ooSmScr5P+4i1cuusbZHvol3BCw59inHo9xRIw04ltsY8JBPmqPgRSwOP Mg5ILit4LQhUmWWa3tfxLunohk+AICIwV63bi5Y/grf7gjtQ7hyV73Rwt/OYZ/q53LBW QhiQ== 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=A4dsUSQI/X7gMuFCMinZV7TulIv6evYZAanpDugJOLpmY/RtJFAv4VS+wC46X0AJqw 124RZkCejdHUXtzy3daSb4MFGrSFOTKNEE3sP3B4+3Tx384A7nDO0YfTlFFRLho/cccT 1j5h6fI0XfXPvwm1/fmH8nXeLH+exjxduCqG9eGwzzi6EVUTrRm13y3VX5+O7iIy8Mqw wRbzGxacIDsSgrsFo26nIDRQxAZe4FdZdxm3szs5gnaXu2R+07SlRhaE7WvULnr7lM+E vhiWEFuNtU/+O9igZlwQwXEEppt3qWXHjDnvmsZU/G1yy90jEbXB2i8i7ye4dLMhvcVu kXWg== X-Gm-Message-State: APjAAAUGEAxWJhsDainhDQtfYrwyi5vx+0P90FsZLIhTYJ8j2A+P1Pve 3udQEMwTuC7lUwJjz9AW+XM3J2HBJMxwkzBcZp3mNnk787qKUafqpQvrU8j1rd/zU9aBtovjpv0 bpw5w/v0EEh11qrDPa0QcRvn70S02mJnYAIL361gaxT+afTY7tqu07w== X-Google-Smtp-Source: APXvYqx8bfPydciDwflNH+VlBKlpBk07ttlrWJioJiuXHGiOlvJmY2hYSiXQ88lZT4UBRGS6Tcy4f64yRw== X-Received: by 2002:a63:1e59:: with SMTP id p25mr35134433pgm.361.1571097858628; Mon, 14 Oct 2019 17:04:18 -0700 (PDT) Date: Mon, 14 Oct 2019 17:04:08 -0700 In-Reply-To: <20191015000411.59740-1-morbo@google.com> Message-Id: <20191015000411.59740-2-morbo@google.com> Mime-Version: 1.0 References: <20191010183506.129921-1-morbo@google.com> <20191015000411.59740-1-morbo@google.com> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb-goog Subject: [kvm-unit-tests PATCH v2 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 Tue Oct 15 00:04:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Wendling X-Patchwork-Id: 11189525 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 2A03218A6 for ; Tue, 15 Oct 2019 00:04:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 01399217F9 for ; Tue, 15 Oct 2019 00:04:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HGtwPmxb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726878AbfJOAEX (ORCPT ); Mon, 14 Oct 2019 20:04:23 -0400 Received: from mail-qk1-f202.google.com ([209.85.222.202]:36937 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726740AbfJOAEW (ORCPT ); Mon, 14 Oct 2019 20:04:22 -0400 Received: by mail-qk1-f202.google.com with SMTP id o133so18579257qke.4 for ; Mon, 14 Oct 2019 17:04:22 -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=HGtwPmxb8RdkpqlxrBrovY6k1ZNLZgNpNKmnXBN8a1pbuj6KiYguwmJrePYZhe43OU dSoWEqFR1yBHmhOtOeJQ1yyI52QKVIP3wEMsBqVHZWvuL7D5bZUvF4xvALK/saYTpMhU geENLrJ0PdgxZT9+GsTsI/LN9viqoci1PFWiMEE4/SzC5b3oQ1rBifTB30z1VRAZ/pIw wCwifvGcCutfnnZ0yAQVwAWD5ClADOSQ1ztsn9Qa05KwavNnh+AACqu4rj676ubn7dTi CyKBuPBlibbzhqKxY/ipGPRwFzvOz2O+Mf0WsSgxp75Wa3M6hP26TozB0AO00eXLrSa8 80Ew== 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=bPgOrSE0xchuRR/+Cxu8Tem2aAEwE0tGsO5Y+eJbN5XZMj2i5/WkUM6UM4PtSYx8Sy b5gW+rPMOScrc3/LRB6/6dTLeuE3fpIdkDNnDhY3+w+WUr/tLR6dTexaACuMvSgn4SiO OC3KUPDHFXaXeWKIytE3y4laa92lLe2cTMLGP1SOHObmWAwvYC6fLMm3Kd1VbuX9G/fM 51l2BSh0e54sy/FNJ34/Rp4MyI8zfZ1DYKr+ncCeh/jvM3beZBjxKSmETJ9U/uzTKppU JgAirDWdrJJooNkUkj94JqN81cbSO+x//xG7UAIa6A6UdE8GfByZ6gM5515G8Fczy2pT Yf0Q== X-Gm-Message-State: APjAAAVk87xFFHsAUjPT1ObI6fiFmM3zf+B+Lv4Y51n8ePxEvI/tc3wf B6fXpcTrETNjjklEB2935gmvrQniZw0RVkxn4bdF2dEwDiE/KwGUzDnHFwGMjZ0A6MO7fu694Kx Ov4nhsm+2dB+A9KIzY+z5uLZiui1AzQ4zp2KGiaLE1mHqqvyqbNU4zQ== X-Google-Smtp-Source: APXvYqzHPFyzZj8ZsK5+NpKH2lYvhf2zIhvFL/D5qcqlSsEGAFhN33Qnjow7vDe/LZ+v6636R+1LK3idgw== X-Received: by 2002:ac8:30c3:: with SMTP id w3mr36407100qta.164.1571097861415; Mon, 14 Oct 2019 17:04:21 -0700 (PDT) Date: Mon, 14 Oct 2019 17:04:09 -0700 In-Reply-To: <20191015000411.59740-1-morbo@google.com> Message-Id: <20191015000411.59740-3-morbo@google.com> Mime-Version: 1.0 References: <20191010183506.129921-1-morbo@google.com> <20191015000411.59740-1-morbo@google.com> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb-goog Subject: [kvm-unit-tests PATCH v2 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 Tue Oct 15 00:04:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Wendling X-Patchwork-Id: 11189527 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 7270817E6 for ; Tue, 15 Oct 2019 00:04:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 538FC2089C for ; Tue, 15 Oct 2019 00:04:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gnFepy27" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726882AbfJOAEZ (ORCPT ); Mon, 14 Oct 2019 20:04:25 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:45739 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbfJOAEZ (ORCPT ); Mon, 14 Oct 2019 20:04:25 -0400 Received: by mail-pg1-f202.google.com with SMTP id v10so1309040pge.12 for ; Mon, 14 Oct 2019 17:04:24 -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=gnFepy27jjZWBkP18M8PxGjLiFmpf5wJIQ8U00bcFwiSrLu+9cR9L/EWEDBSXkR9kc QHtpBLdiCTxZ0ojL7+tHEXf/veSjhOxW5fyb4e6S/vkpB6bPK3+sIHDf0GD8guFnzcOe K6aPPAXPMQMJ70tVMSbSg0GOjyL6ckzL4gmNaGcf3I9y56WUj5nTeIDv75mKKp7XciRQ 6FhJpk39/SYMEKOSyDLbkCVDbryzXf4tVe7MY8ecnhNVLox2eYILe1krA820wZSzHluI UXbfSGx5pC5RTc7hbvDMOmgfLBIwkfcH9LxodyDyKucSq+be7FOBvRx+b2UxBnKPrlPQ 9U2w== 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=abXE9ueyDK3Yj84+oYz5AndZj1nVd6qYPRKFHuLW320R6/dVpp0aY64r0ofDOXEZTz 2xwRSWwesG72ypUBbQ45Ad9X0i0/SHHAwUp9cU41a/xcWy5yAuEmnGsJ+zWT6yCYuAKa AJcrI98hpcRj0AMIAJ12V6uX2J52eR73PtqKh/dRzn/EHQ83oE89f+GiKdVyIXegevMb oK6FRR8AM5JWbVAkyO5vUsIGgYYcw6EbLaPTT1qjDbfde2NLliFEZdyZo1HzaUkha0Vr aJkR78appOtTuosCNPQQVlq/eH8AlfCsXR38GApOD7/tPLNIib+eFJkBhJWeNoder6ZK qx2Q== X-Gm-Message-State: APjAAAX2VL4UaQAexyhKkdmmWRO3KHX4W4H3R2ayn3Tn52FqXB7Ga4DO 1i6u+Xrq1TKtV6Tug9+HudC68DDdcgIolyCzAVGMwzrT1gbeUUoAIWggTKc0ZTTrNdmNFTKXzCk F4mVQ488x00/OApSTVT56qQ905w5noFnPvCTIOe8mL1RrowDrnPX/rw== X-Google-Smtp-Source: APXvYqy/XzmmgVzAFIjC5or4NHSwEPVCNIA3yEdwDaRF7JtGpcUZmJHi9Gk0n/vxbWNexxP5YUKQLmMBug== X-Received: by 2002:a63:5448:: with SMTP id e8mr8296227pgm.10.1571097864201; Mon, 14 Oct 2019 17:04:24 -0700 (PDT) Date: Mon, 14 Oct 2019 17:04:10 -0700 In-Reply-To: <20191015000411.59740-1-morbo@google.com> Message-Id: <20191015000411.59740-4-morbo@google.com> Mime-Version: 1.0 References: <20191010183506.129921-1-morbo@google.com> <20191015000411.59740-1-morbo@google.com> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb-goog Subject: [kvm-unit-tests PATCH v2 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 Tue Oct 15 00:04:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Wendling X-Patchwork-Id: 11189529 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 9326A14E5 for ; Tue, 15 Oct 2019 00:04:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75017217F9 for ; Tue, 15 Oct 2019 00:04:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="P84vo+oM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726895AbfJOAE2 (ORCPT ); Mon, 14 Oct 2019 20:04:28 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:45740 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726885AbfJOAE2 (ORCPT ); Mon, 14 Oct 2019 20:04:28 -0400 Received: by mail-pg1-f202.google.com with SMTP id v10so1309171pge.12 for ; Mon, 14 Oct 2019 17:04:28 -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=P84vo+oMgO+hC058P25Ph2dxwexJhp8/oZi+YFCAsZ+pC7EJ6pSbSW45q56I+rVJ/z 4E8dMozFwbmNxlp4nkJSllfEGfAcKE1azrcH5Z+YACj+s+LsHdRpuVYpDx6LnET21CWl GlIdpHJ0k5CLL0IUK/spw6ZG6TBolSJnbXYQrnRJtilIWWbTa/TJ+e0R8/Tc5nwBfbT/ 0bc+2uHvinWSLynuwTqCx8goX/SWb7az1mZZh5Xz6KO4CdxxtlXvAzqSR70LGmKgE7ok jmz+Y6XBmHbVtYogPljh5f8UTsHq7yN8OUu3tKIyqRhWA/o0yZx5eMnTZRW1WGGkFivZ AhIQ== 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=EW+QBlK5ZsxDT+kZZX3OeZNuzMhR/Fw9WFLUee3NoMNP1zevOlOeTG26jdgmxW4BzE 6XRBZXhMSGKQk7yQU2A73pX9mtPrG0ghailqiF2A+EPzWpg/WReKRUFCc1b+0FMYJz+q AvUHV2kYRF25TdS7XPa/059txBNjRreW0qN+mgueYtnF2hT2cIPuJVbVDDetExQ6ye/I xtbgig+nGtZcOPXGbQUQB6sRs/1YGiIQEgYiiI+ORYCREPTAHr/WCXQyJb2QriM1n8/y Y/aKO5e5vCuK57+XEaL2iEZJFfY53E9x0nrm3gvBihMIyXItLE2al+ibmKOefDBU5WYS SXpg== X-Gm-Message-State: APjAAAU2ks0mly/etpdPS/MhsgRYiXgCxz0w5noBxA0A7hqCnrBsB+pK NcxjKqsJWJB4RQqjkwVaFsaF/kyA1hQqapdeJRpSv3BZrkLseScEcCnFp4XWX3GP5DomLIr3bEk 8NowFKbWHSjiSLimCTQ7MmsC/3fuMcoIfW+T2JGNR4e5c0vFb/Ztt6A== X-Google-Smtp-Source: APXvYqx/z8uL0rx1LaCc9nO1S3trt14XlurqiDKCODuJhO9VP+wu3zQX+ICHfI+U4XvRpt6RIZ6lfxfEbw== X-Received: by 2002:a63:10d:: with SMTP id 13mr36164727pgb.173.1571097867484; Mon, 14 Oct 2019 17:04:27 -0700 (PDT) Date: Mon, 14 Oct 2019 17:04:11 -0700 In-Reply-To: <20191015000411.59740-1-morbo@google.com> Message-Id: <20191015000411.59740-5-morbo@google.com> Mime-Version: 1.0 References: <20191010183506.129921-1-morbo@google.com> <20191015000411.59740-1-morbo@google.com> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb-goog Subject: [kvm-unit-tests PATCH v2 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