From: Mikhail Kashkarov Date: Thu, 17 May 2018 13:32:19 +0000 (+0300) Subject: packaging: Add -Wformat options to disable warnings and tests FAIL. X-Git-Tag: accepted/tizen/base/20180720.112000~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6cb8bbb4a6f6a7812068ca160a39cd535141e873;p=platform%2Fupstream%2Flinaro-gcc.git packaging: Add -Wformat options to disable warnings and tests FAIL. "-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 --- diff --git a/packaging/gcc-aarch64.spec b/packaging/gcc-aarch64.spec index a04e5f8..de57a4a 100644 --- a/packaging/gcc-aarch64.spec +++ b/packaging/gcc-aarch64.spec @@ -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 diff --git a/packaging/gcc-armv7hl.spec b/packaging/gcc-armv7hl.spec index 49f6edf..c72d024 100644 --- a/packaging/gcc-armv7hl.spec +++ b/packaging/gcc-armv7hl.spec @@ -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 diff --git a/packaging/gcc-armv7l.spec b/packaging/gcc-armv7l.spec index 95976e3..6a8604d 100644 --- a/packaging/gcc-armv7l.spec +++ b/packaging/gcc-armv7l.spec @@ -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 diff --git a/packaging/linaro-gcc.spec b/packaging/linaro-gcc.spec index fd960c5..3dd714e 100644 --- a/packaging/linaro-gcc.spec +++ b/packaging/linaro-gcc.spec @@ -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