Message ID | CABtf2+Ruin4Z2B82PGQhUwBUvX_AohvP_KD7Z2u2A2ejHZyOig@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 10/27/2016 10:47 PM, Caroline Tice wrote: > > * config/i386/pmm_malloc.h (posix_memalign): Add ifdefs to only > decorate the declaration with 'throw()' if __GLIBC__ is defined. I seem to recall a similar patch being submitted by Szabolcs. My suggestion at the time was to move _mm_malloc into libgcc so that it could just include the right header. Bernd
On 28/10/16 11:38, Bernd Schmidt wrote: > On 10/27/2016 10:47 PM, Caroline Tice wrote: >> >> * config/i386/pmm_malloc.h (posix_memalign): Add ifdefs to only >> decorate the declaration with 'throw()' if __GLIBC__ is defined. > > I seem to recall a similar patch being submitted by Szabolcs. My suggestion at the time was to move _mm_malloc > into libgcc so that it could just include the right header. > i stopped working on that patch because it seems gcc-6 does not care about inconsistent exception specification in this particular case any more (even in strict standard conform mode) and thus i could not provide a test case along the patch which H.J.Lu asked for. (i also think that hardwiring libc specific knowledge here is wrong: glibc might change its declaration, c++ code should not try to redeclare standard c interfaces, which is just another regression in the c++ language compared to c.)
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)