Blame SOURCES/0150-build-Fix-Wall-and-O2-warnings.patch

26ccd9
From cbe337d6a0ee7d4f0ff9a5c19d14fb5e250df220 Mon Sep 17 00:00:00 2001
26ccd9
From: Dan Williams <dan.j.williams@intel.com>
26ccd9
Date: Wed, 9 Mar 2022 15:36:52 -0800
26ccd9
Subject: [PATCH 150/217] build: Fix '-Wall' and '-O2' warnings
26ccd9
26ccd9
Stop specifying '-Wall and '-O2' in cc_flags, and rely on the buildtype
26ccd9
and warning_level options. Fixup the '-D_FORTIFY_SOURCE=2' option to
26ccd9
optionally be enabled for optimizated builds rather then forcing -O2.
26ccd9
26ccd9
Link: https://github.com/pmem/ndctl/issues/195
26ccd9
Link: https://lore.kernel.org/r/164686901240.2874657.8473455139820858036.stgit@dwillia2-desk3.amr.corp.intel.com
26ccd9
Fixes: 4e5faa1726d2 ("build: Add meson build infrastructure")
26ccd9
Reported-by: Steve Scargall <steve.scargall@intel.com>
26ccd9
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
26ccd9
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
26ccd9
---
26ccd9
 meson.build | 8 +++++---
26ccd9
 1 file changed, 5 insertions(+), 3 deletions(-)
26ccd9
26ccd9
diff --git a/meson.build b/meson.build
26ccd9
index 17ca65a..4dbb80d 100644
26ccd9
--- a/meson.build
26ccd9
+++ b/meson.build
26ccd9
@@ -57,7 +57,6 @@ sed -e s,@VERSION@,@0@,g
26ccd9
 '''.format(meson.project_version(), prefixdir, libdir, includedir).split()
26ccd9
 
26ccd9
 cc_flags = [
26ccd9
-  '-Wall',
26ccd9
   '-Wchar-subscripts',
26ccd9
   '-Wformat-security',
26ccd9
   '-Wmissing-declarations',
26ccd9
@@ -70,9 +69,12 @@ cc_flags = [
26ccd9
   '-Wmaybe-uninitialized',
26ccd9
   '-Wdeclaration-after-statement',
26ccd9
   '-Wunused-result',
26ccd9
-  '-D_FORTIFY_SOURCE=2',
26ccd9
-  '-O2',
26ccd9
 ]
26ccd9
+
26ccd9
+if get_option('optimization') != '0'
26ccd9
+  cc_flags += [ '-D_FORTIFY_SOURCE=2' ]
26ccd9
+endif
26ccd9
+
26ccd9
 cc = meson.get_compiler('c')
26ccd9
 add_project_arguments(cc.get_supported_arguments(cc_flags), language : 'c')
26ccd9
 
26ccd9
-- 
26ccd9
2.27.0
26ccd9