Including mm_malloc.h in C++ code and compiling with -pedantic yields
the following error:

In file included from src/mystuff/c++/memalign.cc:1:
/usr/include/mm_malloc.h:37: error: declaration of 'int
posix_memalign(void**, size_t, size_t) throw ()' throws different exceptions
/usr/include/stdlib.h:130: error: from previous declaration 'int
posix_memalign(void**, size_t, size_t)'

Basically, this assumes we use glibc and emulates the __THROW macro
there.

Patch below is the same thing FreeBSD did; though posix_memalign is
always visible on OpenBSD anyway, so the redeclaration is pointless.
According to glibc, it's XPG6, so it should probably be #ifdef'd
correctly in stdlib.h, but that's another story.


Index: pmm_malloc.h
===================================================================
RCS file: /cvs/src/gnu/gcc/gcc/config/i386/pmm_malloc.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 pmm_malloc.h
--- pmm_malloc.h        15 Oct 2009 17:11:29 -0000      1.1.1.1
+++ pmm_malloc.h        29 May 2012 16:33:47 -0000
@@ -34,7 +34,7 @@
 #ifndef __cplusplus
 extern int posix_memalign (void **, size_t, size_t);
 #else
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+extern "C" int posix_memalign (void **, size_t, size_t);
 #endif
 
 static __inline void *

Reply via email to