Fix build with newer gcc.

This commit is contained in:
Andreas Schneider 2015-02-20 09:49:26 +01:00
parent 74433906f2
commit 370e48b1c3
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,40 @@
From ab0f3769a08de746e0aed60665dfa2638ae3e61d Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@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@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

View File

@ -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