[cmake] Pass -fno-strict-aliasing to cm_sha2.c

Petr Machata pmachata at fedoraproject.org
Thu Jul 25 16:00:19 UTC 2013


commit 2da4c9617897293aa7d4beaeeb846efac7a62e82
Author: Petr Machata <pmachata at redhat.com>
Date:   Thu Jul 25 17:59:28 2013 +0200

    Pass -fno-strict-aliasing to cm_sha2.c

 .gitignore                  |    1 +
 cmake-strict_aliasing.patch |   19 +++++++++++++++++++
 cmake.spec                  |    9 ++++++++-
 3 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 80eceaa..f0a245a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@
 /cmake-2.8.11.tar.gz
 /cmake-2.8.11.1.tar.gz
 /cmake-2.8.11.2.tar.gz
+/cmake-*/
diff --git a/cmake-strict_aliasing.patch b/cmake-strict_aliasing.patch
new file mode 100644
index 0000000..2bc1555
--- /dev/null
+++ b/cmake-strict_aliasing.patch
@@ -0,0 +1,19 @@
+diff -up cmake-2.8.11/Source/CMakeLists.txt\~ cmake-2.8.11/Source/CMakeLists.txt
+--- cmake-2.8.11/Source/CMakeLists.txt~	2013-05-15 19:38:13.000000000 +0200
++++ cmake-2.8.11/Source/CMakeLists.txt	2013-07-25 16:35:01.200389140 +0200
+@@ -308,6 +308,13 @@ if(APPLE)
+     cmLocalXCodeGenerator.h)
+ endif()
+ 
++# GCC shows strict aliasing warnings with cm_sha2.c.  Turn off the
++# corresponding optimizations.
++if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
++  set_source_files_properties(cm_sha2.c PROPERTIES
++			      COMPILE_FLAGS "-fno-strict-aliasing")
++endif()
++
+ 
+ if (WIN32)
+   set(SRCS ${SRCS}
+
+Diff finished.  Thu Jul 25 16:35:18 2013
diff --git a/cmake.spec b/cmake.spec
index c43605c..cd044ad 100644
--- a/cmake.spec
+++ b/cmake.spec
@@ -13,7 +13,7 @@
 
 Name:           cmake
 Version:        2.8.11.2
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Cross-platform make system
 
 Group:          Development/Tools
@@ -43,6 +43,8 @@ Patch3:         cmake-FindPostgreSQL.patch
 Patch4:         cmake-2.8.11-rc1-IM_pkgconfig_hints.patch
 # Add FindLua52.cmake
 Patch5:		cmake-2.8.11-rc4-lua-5.2.patch
+# Add -fno-strict-aliasing when compiling cm_sha2.c
+Patch6:         cmake-strict_aliasing.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  gcc-gfortran
@@ -97,6 +99,7 @@ The %{name}-gui package contains the Qt based GUI for CMake.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 
 %build
@@ -193,6 +196,10 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
 
 
 %changelog
+* Thu Jul 25 2013 Petr Machata <pmachata at redhat.com> - 2.8.11.2-2
+- Pass -fno-strict-aliasing to cm_sha2.c to avoid strict aliasing
+  problems that GCC warns about.
+
 * Tue Jul 9 2013 Orion Poplawski <orion at cora.nwra.com> - 2.8.11.2-1
 - Update to 2.8.11.2 release
 


More information about the scm-commits mailing list