packaging: Add -Wformat options to disable warnings and tests FAIL.
[platform/upstream/linaro-gcc.git] / packaging / gcc-armv7l.spec
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