The posix_memalign declaration in gcc/i386/config/pmm_malloc.h is
decorated with 'throw ()', which occasionally causes declaration
conflict errors (some header files, not part of GCC, that declare
posix_memalign, do not have the throw decoration).  An example of this
can be seen at https://github.com/android-ndk/ndk/issues/91.  It
appears that the 'throw()' decoration comes from glibc header files.
Adding ifdefs to check for __GLIBC__ before adding the 'throw()' fixed
the github problem mentioned above.

I have tested this patch by bootstrapping and by running test
testsuite with no regressions.

Is this ok to commit?

-- Caroline Tice
ctic...@gmail.com


gcc/ChangeLog:

2016-10-27  Caroline Tice  <cmt...@google.com>

        * config/i386/pmm_malloc.h (posix_memalign):  Add ifdefs to only
        decorate the declaration with 'throw()' if __GLIBC__ is defined.
Index: gcc/config/i386/pmm_malloc.h
===================================================================
--- gcc/config/i386/pmm_malloc.h	(revision 241483)
+++ gcc/config/i386/pmm_malloc.h	(working copy)
@@ -31,8 +31,12 @@
 #ifndef __cplusplus
 extern int posix_memalign (void **, size_t, size_t);
 #else
+#ifdef __GLIBC__
 extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+#else
+extern "C" int posix_memalign (void **, size_t, size_t);
 #endif
+#endif
 
 static __inline void *
 _mm_malloc (size_t __size, size_t __alignment)

Reply via email to