From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C3E85A034E;
	Fri, 21 Jan 2022 17:12:57 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 546524276E;
	Fri, 21 Jan 2022 17:12:57 +0100 (CET)
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by mails.dpdk.org (Postfix) with ESMTP id A87FD40040
 for <dev@dpdk.org>; Fri, 21 Jan 2022 17:12:55 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1642781575; x=1674317575;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=kz1u8vHoGohWTIH6ymo4CsODI53r6jTec7mdgJw6brA=;
 b=KQL7DwOvPSqoVLObNzLFyxcj9sv8sXMzW5S1kHshnWqwFq1sg58mhVLn
 VkWR9tlpukYvKX+TEPSdzmintXfOp9S1RltOGdceuCuVvoEONoRLChX7Q
 ClfU9zxs52SbuvTG4oLhhQYzCIaGbvzTQr7neN0Pe6FHK64KtCnjjPU8O
 H7OyCO7IUKsxRBX5Kn8IPNaEEJsXXcPI4rPJ1FcGc83hQgMqCBk4coggR
 yNpqKamnd0AcIVT1x5946uxjKTaGNr1YZXKP6v28Rf6xvEss/F5TDAZ3z
 R8lIn2A37o73lGfym1pSLaR0FgFaERKBpPcbiJ4aagSGVUcXWeDihh3qd g==;
X-IronPort-AV: E=McAfee;i="6200,9189,10233"; a="225669605"
X-IronPort-AV: E=Sophos;i="5.88,304,1635231600"; d="scan'208";a="225669605"
Received: from orsmga006.jf.intel.com ([10.7.209.51])
 by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 21 Jan 2022 08:12:37 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.88,304,1635231600"; d="scan'208";a="478290173"
Received: from silpixa00399126.ir.intel.com ([10.237.223.86])
 by orsmga006.jf.intel.com with ESMTP; 21 Jan 2022 08:12:36 -0800
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH v2] build: fix meson warning about using compiler warning flags
Date: Fri, 21 Jan 2022 16:12:30 +0000
Message-Id: <20220121161230.1994909-1-bruce.richardson@intel.com>
X-Mailer: git-send-email 2.32.0
In-Reply-To: <20220121155346.1994682-1-bruce.richardson@intel.com>
References: <20220121155346.1994682-1-bruce.richardson@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Each build, meson would issue a warning reporting that the
"warning_level" setting should be used in place of adding -Wextra
directly to our build commands. Testing with meson 0.61 shows that the
only difference for gcc and clang builds between warning levels 1 and
2 is the addition of -Wextra, so we can remove the warning by deleting
our explicit set of Wextra and changing the build defaults to
warning_level 2.

Fixes: 524a0d5d66b9 ("build: enable extra warnings with meson")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
V2: fixed CI apply issues due to V1 being based on top of patch
    'build: fix warnings when running external commands'

NOTE1: Not putting CC stable for this patch, I don't believe it's worth
the risk of backporting.

NOTE2: For reference, when building a test "hello world" project with
different warning levels, the following flags are used by meson:

warning_level=0: <none>
warning_level=1: -Wall -Winvalid-pch
warning_level=2: -Wall -Winvalid-pch -Wextra
warning_level=3: -Wall -Winvalid-pch -Wextra -Wpedantic
---
 config/meson.build | 5 ++---
 meson.build        | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index 805d5d51d0..cb236d9187 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -246,10 +246,9 @@ endif
 add_project_arguments('-include', 'rte_config.h', language: 'c')
 
 # enable extra warnings and disable any unwanted warnings
+# -Wall is added by default at warning level 1, and -Wextra
+# at warning level 2 (DPDK default)
 warning_flags = [
-        # -Wall is added by meson by default, so add -Wextra only
-        '-Wextra',
-
         # additional warnings in alphabetical order
         '-Wcast-qual',
         '-Wdeprecated',
diff --git a/meson.build b/meson.build
index 12cb6e0e83..0a844bce9e 100644
--- a/meson.build
+++ b/meson.build
@@ -7,7 +7,7 @@ project('DPDK', 'C',
         version: run_command(find_program('cat', 'more'),
             files('VERSION')).stdout().strip(),
         license: 'BSD',
-        default_options: ['buildtype=release', 'default_library=static'],
+        default_options: ['buildtype=release', 'default_library=static', 'warning_level=2'],
         meson_version: '>= 0.49.2'
 )
 
-- 
2.32.0