packaging: Add -Wformat options to disable warnings and tests FAIL. 98/179398/2
authorMikhail Kashkarov <m.kashkarov@partner.samsung.com>
Thu, 17 May 2018 13:32:19 +0000 (16:32 +0300)
committerDongkyun Son <dongkyun.s@samsung.com>
Thu, 19 Jul 2018 09:13:50 +0000 (09:13 +0000)
"-Wformat-..." options generate warnings like:

  cc1: warning: -Wformat-security ignored without -Wformat [-Wformat-security]

that makes a lot of unexpected failures in testsuite while checking produced
output (FAIL: .. test for excess errors) and also results comparison is messed
up for the new tests.
Insert -Wformat if it's missing.

Change-Id: Ia61f256b1f8c3fe5b3ee3c02d363eb901c68adbe

packaging/gcc-aarch64.spec
packaging/gcc-armv7hl.spec
packaging/gcc-armv7l.spec
packaging/linaro-gcc.spec

index a04e5f8..de57a4a 100644 (file)
@@ -696,6 +696,17 @@ RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(sse\|fpmath\)[^ ]*//g'`
 }
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/  */ /g'`
+
+# -Wall is stripped off now, so -Wformat will not turn on implicitly for
+# "-Wformat-.." option group, causing additional build warnings and testsuite
+# FAIL ("test for excess errors" type).
+# Insert "-Wformat" if we find "-Wformat-..."
+if [ ! -z "$(echo $RPM_OPT_FLAGS | grep -o "\B\-Wformat\-")" ]; then
+    if [ -z "$(echo $RPM_OPT_FLAGS | grep -Po "\B\-Wformat(\s|\Z)")" ]; then
+        RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e "s/-Wformat-/-Wformat -Wformat-/")
+    fi
+fi
+
 %{?asan: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -DASAN_INIT_FIRST) }
 
 %ifarch armv7l armv7hl aarch64
index 49f6edf..c72d024 100644 (file)
@@ -696,6 +696,17 @@ RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(sse\|fpmath\)[^ ]*//g'`
 }
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/  */ /g'`
+
+# -Wall is stripped off now, so -Wformat will not turn on implicitly for
+# "-Wformat-.." option group, causing additional build warnings and testsuite
+# FAIL ("test for excess errors" type).
+# Insert "-Wformat" if we find "-Wformat-..."
+if [ ! -z "$(echo $RPM_OPT_FLAGS | grep -o "\B\-Wformat\-")" ]; then
+    if [ -z "$(echo $RPM_OPT_FLAGS | grep -Po "\B\-Wformat(\s|\Z)")" ]; then
+        RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e "s/-Wformat-/-Wformat -Wformat-/")
+    fi
+fi
+
 %{?asan: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -DASAN_INIT_FIRST) }
 
 %ifarch armv7l armv7hl aarch64
index 95976e3..6a8604d 100644 (file)
@@ -696,6 +696,17 @@ RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(sse\|fpmath\)[^ ]*//g'`
 }
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/  */ /g'`
+
+# -Wall is stripped off now, so -Wformat will not turn on implicitly for
+# "-Wformat-.." option group, causing additional build warnings and testsuite
+# FAIL ("test for excess errors" type).
+# Insert "-Wformat" if we find "-Wformat-..."
+if [ ! -z "$(echo $RPM_OPT_FLAGS | grep -o "\B\-Wformat\-")" ]; then
+    if [ -z "$(echo $RPM_OPT_FLAGS | grep -Po "\B\-Wformat(\s|\Z)")" ]; then
+        RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e "s/-Wformat-/-Wformat -Wformat-/")
+    fi
+fi
+
 %{?asan: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -DASAN_INIT_FIRST) }
 
 %ifarch armv7l armv7hl aarch64
index fd960c5..3dd714e 100644 (file)
@@ -693,6 +693,17 @@ RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(sse\|fpmath\)[^ ]*//g'`
 }
 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/  */ /g'`
+
+# -Wall is stripped off now, so -Wformat will not turn on implicitly for
+# "-Wformat-.." option group, causing additional build warnings and testsuite
+# FAIL ("test for excess errors" type).
+# Insert "-Wformat" if we find "-Wformat-..."
+if [ ! -z "$(echo $RPM_OPT_FLAGS | grep -o "\B\-Wformat\-")" ]; then
+    if [ -z "$(echo $RPM_OPT_FLAGS | grep -Po "\B\-Wformat(\s|\Z)")" ]; then
+        RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e "s/-Wformat-/-Wformat -Wformat-/")
+    fi
+fi
+
 %{?asan: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -DASAN_INIT_FIRST) }
 
 %ifarch armv7l armv7hl aarch64