Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp276436pxb; Fri, 29 Oct 2021 09:38:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHKOzGnRoPSmLNSpbBFxdnaf3MBRZRFuPxsbk28Ub90qKl0HlnLyr33TtHdzFFYhWOz0ia X-Received: by 2002:a05:6e02:18c6:: with SMTP id s6mr8559699ilu.168.1635525498465; Fri, 29 Oct 2021 09:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635525498; cv=none; d=google.com; s=arc-20160816; b=H9nrqkSBg1Ozt96v1YZV5vU05NL1+I9Zph5h/PlmAytDwW2H/qsWC3Wtr3Yxf725Lf owoXsegIoLvC0R3FegEsobLyUacn1oW0RM0NFnp2/Uy9hw1s9rslmZaSHLb+M3YjSKj0 IdMacaNy+CEHVrWoEKSW7mFvzttq72sYmzf9fiKVd8RPzBgmONw3Xa33XA17Vp+IatTV MgaBrJ6zf3rOetg9bTn2erQt18cUQE+pOzQnKgwbw3Xsy16GdRcPa4UMw0dF64O1G7sw K5vrVLCPRkSVFHeJ9Pl/aVKHJNvoawVMfjCUzewDDlLcDZJHIwfVh/WjkCIq0vCJlohS hOVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=cneUHes9vowPUlxDXr8QOLoR4mns4WEw0bjPvTYz9lA=; b=dQ5rGS5QXNPD1zHMtIPMmpMGVAJhp9pOBXDNsEeQ6uN4Qp1a2chZtrog3mvLSPu17/ 8VTy42jAFIpwGg5nnxMy2iAmnNlp6AssZHvpwehjIt7fAPSL+Zz1lAhzbot5uJJLEEd7 6x789lfcU1YF8kqN6ZnTUbfxvSYPDqhW1R6tOGg3TLU04sfO+7zswo4xhlYDN4KI0gmm FAVEG1/ULr7ypqVvVBqjwrWe52fR6+BAkjxfYoDCi0bnPGtQPmlHs+0DkGrxX9zF/Q/y 6HuL+nuQPiYXuTb5H9oHmRZGGTd8HD+ptG5sXUL3Vq9FYch01vXxmfkoAUiOERVgACen uzbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si10913606ilu.180.2021.10.29.09.38.06; Fri, 29 Oct 2021 09:38:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbhJ2QiQ (ORCPT + 99 others); Fri, 29 Oct 2021 12:38:16 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:4041 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbhJ2QiP (ORCPT ); Fri, 29 Oct 2021 12:38:15 -0400 Received: from fraeml713-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Hgnyg0ytGz67MlN; Sat, 30 Oct 2021 00:32:27 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml713-chm.china.huawei.com (10.206.15.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Fri, 29 Oct 2021 18:35:44 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Fri, 29 Oct 2021 17:35:41 +0100 From: John Garry To: , , , , , , , CC: , , , John Garry Subject: [PATCH] perf tools: Enable warnings through HOSTCFLAGS Date: Sat, 30 Oct 2021 00:30:41 +0800 Message-ID: <1635525041-151876-1-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The tools build system uses KBUILD_HOSTCFLAGS symbol for obvious purposes. However this is not set for anything under tools/ As such, host tools apps built have no compiler warnings enabled. Declare HOSTCFLAGS for perf tools build, and also use that symbol in declaration of host_c_flags. HOSTCFLAGS comes from EXTRA_WARNINGS, which is independent of target platform/arch warning flags. Suggested-by: Jiri Olsa Signed-off-by: John Garry -- Using HOSTCFLAGS, as opposed to KBUILD_HOSTCFLAGS, is going opposite direction to commit 96f14fe738b6 ("kbuild: Rename HOSTCFLAGS to KBUILD_HOSTCFLAGS"), so would like further opinion from Laura and Masahiro. diff --git a/tools/build/Build.include b/tools/build/Build.include index 2cf3b1bde86e..c2a95ab47379 100644 --- a/tools/build/Build.include +++ b/tools/build/Build.include @@ -99,7 +99,7 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXX ### ## HOSTCC C flags -host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) +host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) # output directory for tests below TMPOUT = .tmp_$$$$ diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 4a9baed28f2e..9b95ba09657f 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -17,6 +17,7 @@ detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) +HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) include $(srctree)/tools/scripts/Makefile.arch @@ -211,6 +212,7 @@ endif ifneq ($(WERROR),0) CORE_CFLAGS += -Werror CXXFLAGS += -Werror + HOSTCFLAGS += -Werror endif ifndef DEBUG @@ -292,6 +294,9 @@ CXXFLAGS += -ggdb3 CXXFLAGS += -funwind-tables CXXFLAGS += -Wno-strict-aliasing +HOSTCFLAGS += -Wall +HOSTCFLAGS += -Wextra + # Enforce a non-executable stack, as we may regress (again) in the future by # adding assembler files missing the .GNU-stack linker note. LDFLAGS += -Wl,-z,noexecstack diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index a3966f290297..8ca656aa8b06 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -226,7 +226,7 @@ else endif export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK -export HOSTCC HOSTLD HOSTAR +export HOSTCC HOSTLD HOSTAR HOSTCFLAGS include $(srctree)/tools/build/Makefile.include -- 2.17.1