Patchwork [libffi] Define macros carefully

login
register
mail settings
Submitter Anthony Green
Date Aug. 6, 2010, 12:27 p.m.
Message ID <m37hk4gc4l.fsf@redhat.com>
Download mbox | patch
Permalink /patch/61107/
State New
Headers show

Comments

Anthony Green - Aug. 6, 2010, 12:27 p.m.
I'm checking in the following libffi patches.

This patch from Dan Horák protects the #definition of many generic
looking macros with #ifndef.

Thanks,

AG



2010-07-07  Dan Horák <dan@danny.cz>

	* include/ffi.h.in: Protect #define with #ifndef.
	* src/powerpc/ffitarget.h: Ditto.
	* src/s390/ffitarget.h: Ditto.
	* src/sparc/ffitarget.h: Ditto.

Patch

Index: libffi/include/ffi.h.in
===================================================================
--- libffi.orig/include/ffi.h.in
+++ libffi/include/ffi.h.in
@@ -57,7 +57,9 @@  extern "C" {
 #endif
 
 /* Specify which architecture libffi is configured for. */
+#ifndef @TARGET@
 #define @TARGET@
+#endif
 
 /* ---- System configuration information --------------------------------- */
 
Index: libffi/src/powerpc/ffitarget.h
===================================================================
--- libffi.orig/src/powerpc/ffitarget.h
+++ libffi/src/powerpc/ffitarget.h
@@ -31,12 +31,18 @@ 
 /* ---- System specific configurations ----------------------------------- */
 
 #if defined (POWERPC) && defined (__powerpc64__)	/* linux64 */
+#ifndef POWERPC64
 #define POWERPC64
+#endif
 #elif defined (POWERPC_DARWIN) && defined (__ppc64__)	/* Darwin */
+#ifndef POWERPC64
 #define POWERPC64
+#endif
 #elif defined (POWERPC_AIX) && defined (__64BIT__)	/* AIX64 */
+#ifndef POWERPC64
 #define POWERPC64
 #endif
+#endif
 
 #ifndef LIBFFI_ASM
 typedef unsigned long          ffi_arg;
Index: libffi/src/s390/ffitarget.h
===================================================================
--- libffi.orig/src/s390/ffitarget.h
+++ libffi/src/s390/ffitarget.h
@@ -28,8 +28,10 @@ 
 #define LIBFFI_TARGET_H
 
 #if defined (__s390x__)
+#ifndef S390X
 #define S390X
 #endif
+#endif
 
 /* ---- System specific configurations ----------------------------------- */
 
Index: libffi/src/sparc/ffitarget.h
===================================================================
--- libffi.orig/src/sparc/ffitarget.h
+++ libffi/src/sparc/ffitarget.h
@@ -30,8 +30,10 @@ 
 /* ---- System specific configurations ----------------------------------- */
 
 #if defined(__arch64__) || defined(__sparcv9)
+#ifndef SPARC64
 #define SPARC64
 #endif
+#endif
 
 #ifndef LIBFFI_ASM
 typedef unsigned long          ffi_arg;