From 1b1dfd1ae368172e408cceb02db0ca190cff4b61 Mon Sep 17 00:00:00 2001 From: Björn Esser Date: Mar 30 2016 08:04:55 +0000 Subject: add Patch0, fix nullptr-checks with GCC6 in YDialog do not append '-fno-delete-null-pointer-checks' to %%optflags, keeping optimized performance --- diff --git a/libyui-3.2.4-fix_werror_nonnull_compare_gcc6.patch b/libyui-3.2.4-fix_werror_nonnull_compare_gcc6.patch new file mode 100644 index 0000000..61a09a5 --- /dev/null +++ b/libyui-3.2.4-fix_werror_nonnull_compare_gcc6.patch @@ -0,0 +1,53 @@ +From e49f4dde7351152908aaec18969789377f96f631 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Wed, 30 Mar 2016 09:12:04 +0200 +Subject: [PATCH] Fix 'Werror=nonnull-compare' for GCC 6 See: + https://gcc.gnu.org/gcc-6/porting_to.html +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + + Optimizations remove null pointer checks for 'this' + + …/src/YDialog.cc: In member function 'bool YDialog::destroy(bool)': + …/src/YDialog.cc:254:24: error: + nonnull argument 'this' compared to NULL [-Werror=nonnull-compare] + YUI_CHECK_WIDGET( this ); + ~~~~~~~~~^~~~~~ +--- + src/YUIException.h | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/src/YUIException.h b/src/YUIException.h +index f0dcb21..f87fa8b 100644 +--- a/src/YUIException.h ++++ b/src/YUIException.h +@@ -172,11 +172,27 @@ class YWidget; + /** + * Check if a widget pointer is valid. + * Throws YUIInvalidWidgetException if it is 0 or invalid (already deleted). ++ * ++ * Explicitly casting the memory-address stored in the given pointer to ++ * a boolean-type for null-poiter-checks is needed for GCC >= 6, because ++ * it introduces new optimizations to remove null-pointer-checks for 'this'. ++ * ++ * Not explicitly casting the pointer's memory-address, will cause the ++ * compilation to fail with an error, when using this macro in YDialog: ++ * ++ * …/src/YDialog.cc: In member function 'bool YDialog::destroy(bool)': ++ * …/src/YDialog.cc:254:24: error: ++ * nonnull argument 'this' compared to NULL [-Werror=nonnull-compare] ++ * YUI_CHECK_WIDGET( this ); ++ * ~~~~~~~~~^~~~~~ ++ * ++ * See: https://gcc.gnu.org/gcc-6/porting_to.html + **/ + #define YUI_CHECK_WIDGET( WIDGET ) \ + do \ + { \ +- if ( ! (WIDGET) || ! (WIDGET)->isValid() ) \ ++ if ( ! ( static_cast (WIDGET) ) || \ ++ ! (WIDGET)->isValid() ) \ + { \ + YUI_THROW( YUIInvalidWidgetException() ); \ + } \ diff --git a/libyui.spec b/libyui.spec index bbadb1b..9026d50 100644 --- a/libyui.spec +++ b/libyui.spec @@ -14,20 +14,18 @@ # CMake-builds go out-of-tree. %global _cmake_build_subdir build-%{?_arch}%{?dist} -# Keep nullptr-checks with GCC6. -%if 0%{?fedora} >= 24 || 0%{?rhel} >= 8 -%global optflags %(echo '%{optflags} -fno-delete-null-pointer-checks') -%endif # 0%%{?fedora} >= 24 || 0%%{?rhel} >= 8 - Name: lib%{libsuffix} Version: 3.2.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: GUI-abstraction library License: (LGPLv2 or LGPLv3) and MIT URL: https://github.com/%{name}/%{name} Source0: %{url}/archive/%{name}/master/%{version}.tar.gz#/%{name}-%{version}.tar.gz +# Submitted upstream: https://github.com/libyui/libyui/pull/97 +Patch0000: https://github.com/besser82/libyui/commit/e49f4dde7351152908aaec18969789377f96f631.patch#/%{name}-3.2.4-fix_werror_nonnull_compare_gcc6.patch + BuildRequires: boost-devel BuildRequires: cmake >= 2.8 @@ -74,6 +72,7 @@ brief examples how to build a UI using %{name}. %prep %setup -qn %{name}-%{name}-master-%{version} +%patch0000 -p1 -b .nonnull_compare_gcc6 ./bootstrap.sh @@ -143,6 +142,11 @@ popd %changelog +* Wed Mar 30 2016 Björn Esser - 3.2.4-2 +- add Patch0, fix nullptr-checks with GCC6 in YDialog +- do not append '-fno-delete-null-pointer-checks' to %%optflags, + keeping optimized performance + * Tue Mar 29 2016 Björn Esser - 3.2.4-1 - new upstream release - drop Patch1, applied in upstream tarball