[cmocka/el6] Fix build with newer gcc.

asn asn at fedoraproject.org
Fri Feb 20 12:10:02 UTC 2015


commit 0339de9acb8992b551304730c7767f56bf5f591f
Author: Andreas Schneider <asn at cryptomilk.org>
Date:   Fri Feb 20 09:49:26 2015 +0100

    Fix build with newer gcc.

 cmocka-1.0.0-fix_build_with_newer_gcc.patch | 40 +++++++++++++++++++++++++++++
 cmocka.spec                                 |  3 +++
 2 files changed, 43 insertions(+)
---
diff --git a/cmocka-1.0.0-fix_build_with_newer_gcc.patch b/cmocka-1.0.0-fix_build_with_newer_gcc.patch
new file mode 100644
index 0000000..a8b0362
--- /dev/null
+++ b/cmocka-1.0.0-fix_build_with_newer_gcc.patch
@@ -0,0 +1,40 @@
+From ab0f3769a08de746e0aed60665dfa2638ae3e61d Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn at cryptomilk.org>
+Date: Fri, 20 Feb 2015 09:47:44 +0100
+Subject: [PATCH 1/2] include: Fix building with newer gcc versions.
+
+__func__ is not a macro. We just need to define it on Windows for now.
+
+Signed-off-by: Andreas Schneider <asn at cryptomilk.org>
+---
+ include/cmocka.h | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/include/cmocka.h b/include/cmocka.h
+index 303d0ae..43336e8 100644
+--- a/include/cmocka.h
++++ b/include/cmocka.h
+@@ -19,6 +19,8 @@
+ #ifdef _WIN32
+ # ifdef _MSC_VER
+ 
++#define __func__ __FUNCTION__
++
+ # ifndef inline
+ #define inline __inline
+ # endif /* inline */
+@@ -52,11 +54,6 @@ int __stdcall IsDebuggerPresent();
+  * @{
+  */
+ 
+-/* For those who are used to __func__ from gcc. */
+-#ifndef __func__
+-#define __func__ __FUNCTION__
+-#endif
+-
+ /* If __WORDSIZE is not set, try to figure it out and default to 32 bit. */
+ #ifndef __WORDSIZE
+ # if defined(__x86_64__) && !defined(__ILP32__)
+-- 
+2.1.0
+
diff --git a/cmocka.spec b/cmocka.spec
index 6601168..8b8095d 100644
--- a/cmocka.spec
+++ b/cmocka.spec
@@ -12,6 +12,7 @@ Summary:        Lightweight library to simplify and generalize unit tests for C
 Url:            http://cmocka.org
 
 Source0:        https://open.cryptomilk.org/attachments/download/54/%{name}-%{version}.tar.xz
+Patch0:         cmocka-1.0.0-fix_build_with_newer_gcc.patch
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 %description
@@ -84,6 +85,8 @@ Development headers for the cmocka unit testing library.
 %prep
 %setup -q
 
+%patch0 -p1 -b .cmocka-1.0.0-fix_build_with_newer_gcc.patch
+
 %build
 if test ! -e "obj"; then
   mkdir obj


More information about the scm-commits mailing list