From patchwork Wed Oct 11 07:29:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13416810 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB87DCD98F6 for ; Wed, 11 Oct 2023 07:29:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345393AbjJKH36 (ORCPT ); Wed, 11 Oct 2023 03:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345420AbjJKH3s (ORCPT ); Wed, 11 Oct 2023 03:29:48 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EBD81BFB for ; Wed, 11 Oct 2023 00:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697009359; x=1728545359; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sk7+SDf5VMSdPv94BbG9zAThSlfGA2P7R80rkLeBe7M=; b=LOa9dBPGD/WC82hHaKC+5zPPVEyiqzMzQfnz3cqFfmbCPUYkonfleebY 1XYikzDCiZLF+sw/gLB+Jy+WD7bU3eJsJ2q1rCJJ7Zj6y8XCN7TvVRF7H esuQF+tFlE63HoC89XXq+wfUv3pK4gRJHYrUEyj68erfIcOocZUlbq/iX FTuLhDyhjXiZT3Z5ZuGQNADQu+sx8yVdOFzILcKR0wJGTml4HMucmqyNR Pj3PzlAcnDV3GaBrXSW3trsEoUWnW/qGvIEc/j+YVLUIyxNf/vMxFbDYn 20T2dntQGLYhRejEYVpAsIwZvdb8j2KCjTmHy1YRBxKkuoNGeTmDtHCvG g==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="448802433" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="448802433" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 00:29:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="757443270" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="757443270" Received: from wprelogx-mobl.ger.corp.intel.com (HELO localhost) ([10.252.56.229]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 00:29:14 -0700 From: Jani Nikula To: intel-gfx@lists.freedesktop.org Cc: linux-kbuild@vger.kernel.org, jani.nikula@intel.com, Arnd Bergmann , Nick Desaulniers , Nathan Chancellor , Masahiro Yamada Subject: [PATCH v2 1/2] drm/i915: drop -Wall and related disables from cflags as redundant Date: Wed, 11 Oct 2023 10:29:03 +0300 Message-Id: <5ab754ddc2e342c75deb8476275984918e573beb.1697009258.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The kernel top level Makefile, and recently scripts/Makefile.extrawarn, have included -Wall, and the disables -Wno-format-security and $(call cc-disable-warning,frame-address,) for a very long time. They're redundant in our local subdir-ccflags-y and can be dropped. Cc: Arnd Bergmann Cc: Nick Desaulniers Cc: Nathan Chancellor Cc: Masahiro Yamada Reviewed-by: Nathan Chancellor Acked-by: Nick Desaulniers Signed-off-by: Jani Nikula Reviewed-by: Masahiro Yamada --- drivers/gpu/drm/i915/Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index dec78efa452a..623f81217442 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -5,22 +5,20 @@ # Add a set of useful warning flags and enable -Werror for CI to prevent # trivial mistakes from creeping in. We have to do this piecemeal as we reject -# any patch that isn't warning clean, so turning on -Wall -Wextra (or W=1) we +# any patch that isn't warning clean, so turning on -Wextra (or W=1) we # need to filter out dubious warnings. Still it is our interest # to keep running locally with W=1 C=1 until we are completely clean. # -# Note the danger in using -Wall -Wextra is that when CI updates gcc we +# Note the danger in using -Wextra is that when CI updates gcc we # will most likely get a sudden build breakage... Hopefully we will fix # new warnings before CI updates! -subdir-ccflags-y := -Wall -Wextra -subdir-ccflags-y += -Wno-format-security +subdir-ccflags-y := -Wextra subdir-ccflags-y += -Wno-unused-parameter subdir-ccflags-y += -Wno-type-limits subdir-ccflags-y += -Wno-missing-field-initializers subdir-ccflags-y += -Wno-sign-compare subdir-ccflags-y += -Wno-shift-negative-value subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable) -subdir-ccflags-y += $(call cc-disable-warning, frame-address) subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror # Fine grained warnings disable From patchwork Wed Oct 11 07:29:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13416812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75975CD98F6 for ; Wed, 11 Oct 2023 07:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345567AbjJKHiQ (ORCPT ); Wed, 11 Oct 2023 03:38:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345563AbjJKHiI (ORCPT ); Wed, 11 Oct 2023 03:38:08 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70001137 for ; Wed, 11 Oct 2023 00:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697009363; x=1728545363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0bDVhhRFjtCy3bbgG+aChsC8tbsXgtOqUXfZpFIGH94=; b=bl2tolytwYuYNdF93z/U7VwKWxOwkANXRMe3uZ2b1jbEFGVZej/wo1DK EeH8R8IFGarKX4tmDQCxwQkcyKBTZ5c1r1wP+AWjLgInG2M7ZovjtHxlV wRwQlkFpL61e7ocpWVQVX96haybcc2dA/wTilLejK6Ao1l7zTgKmUOKsr Tu0sD6/8MHqUtsNOLL4DS5g49r5JDEvMCdgh2MNzZQAl0L6GvLuB+zo4H 9y8nbqdZwKsgf72/hQmu/47DzbgI3ht4/eymQn0NSI45WAyrIpR4IVqot r5M/7ngvNDM75EFBFXXvFh7gvcqJlGnn3urdAwo6qvS5b1XqzA9JRs7LA Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="3192019" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="3192019" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 00:29:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="747352246" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="747352246" Received: from wprelogx-mobl.ger.corp.intel.com (HELO localhost) ([10.252.56.229]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 00:29:19 -0700 From: Jani Nikula To: intel-gfx@lists.freedesktop.org Cc: linux-kbuild@vger.kernel.org, jani.nikula@intel.com, Arnd Bergmann , Nick Desaulniers , Nathan Chancellor , Masahiro Yamada Subject: [PATCH v2 2/2] drm/i915: enable W=1 warnings by default Date: Wed, 11 Oct 2023 10:29:04 +0300 Message-Id: <69a812273091b6535ddc7f9346289d71bb30f43d.1697009258.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org We enable a bunch more compiler warnings than the kernel defaults. However, they've drifted to become a unique set of warnings, and have increasingly fallen behind from the W=1 set. Align with the W=1 warnings from scripts/Makefile.extrawarn for clarity, by copy-pasting them with s/KBUILD_CFLAGS/subdir-ccflags-y/ to make it easier to compare in the future. Some of the -Wextra warnings do need to be disabled, just like in Makefile.extrawarn, but take care to not disable them for W=2 or W=3 builds, depending on the warning. v2: Add back some -Wextra warning disables (Nathan) Cc: Arnd Bergmann Cc: Nick Desaulniers Cc: Nathan Chancellor Cc: Masahiro Yamada Reviewed-by: Nathan Chancellor Signed-off-by: Jani Nikula Reviewed-by: Masahiro Yamada --- drivers/gpu/drm/i915/Makefile | 42 ++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 623f81217442..94f84befa38f 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -3,22 +3,34 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -# Add a set of useful warning flags and enable -Werror for CI to prevent -# trivial mistakes from creeping in. We have to do this piecemeal as we reject -# any patch that isn't warning clean, so turning on -Wextra (or W=1) we -# need to filter out dubious warnings. Still it is our interest -# to keep running locally with W=1 C=1 until we are completely clean. -# -# Note the danger in using -Wextra is that when CI updates gcc we -# will most likely get a sudden build breakage... Hopefully we will fix -# new warnings before CI updates! -subdir-ccflags-y := -Wextra -subdir-ccflags-y += -Wno-unused-parameter -subdir-ccflags-y += -Wno-type-limits -subdir-ccflags-y += -Wno-missing-field-initializers -subdir-ccflags-y += -Wno-sign-compare -subdir-ccflags-y += -Wno-shift-negative-value +# Unconditionally enable W=1 warnings locally +# --- begin copy-paste W=1 warnings from scripts/Makefile.extrawarn +subdir-ccflags-y += -Wextra -Wunused -Wno-unused-parameter +subdir-ccflags-y += -Wmissing-declarations +subdir-ccflags-y += $(call cc-option, -Wrestrict) +subdir-ccflags-y += -Wmissing-format-attribute +subdir-ccflags-y += -Wmissing-prototypes +subdir-ccflags-y += -Wold-style-definition +subdir-ccflags-y += -Wmissing-include-dirs subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable) +subdir-ccflags-y += $(call cc-option, -Wunused-const-variable) +subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned) +subdir-ccflags-y += $(call cc-option, -Wformat-overflow) +subdir-ccflags-y += $(call cc-option, -Wformat-truncation) +subdir-ccflags-y += $(call cc-option, -Wstringop-overflow) +subdir-ccflags-y += $(call cc-option, -Wstringop-truncation) +# The following turn off the warnings enabled by -Wextra +ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),) +KBUILD_CFLAGS += -Wno-missing-field-initializers +KBUILD_CFLAGS += -Wno-type-limits +KBUILD_CFLAGS += -Wno-shift-negative-value +endif +ifeq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) +KBUILD_CFLAGS += -Wno-sign-compare +endif +# --- end copy-paste + +# Enable -Werror in CI and development subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror # Fine grained warnings disable