On Fri, Aug 19, 2022 at 07:41:01PM +1000, Jonathan Gray wrote:
> On Fri, Aug 19, 2022 at 04:35:20PM +1000, Jonathan Gray wrote:
> > On Thu, Aug 18, 2022 at 10:38:38PM -0400, Brad Smith wrote:
> > > While trying to update to the latest MariaDB release I ran into an issue
> > > with the stdlib.h header where it does not expose aligned_alloc() in C++11
> > > mode breaking the build. Looking around this was fixed in FreeBSD, NetBSD
> > > and DragonFly years ago.
> > > 
> > > https://github.com/freebsd/freebsd-src/commit/79d09835dd3c33a699b00d00ec50be6a4512b57f
> > 
> > It does not appear in the standard drafts until c++17
> > 
> > llvm cstdlib also has
> > #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_ALIGNED_ALLOC)
> > using ::aligned_alloc _LIBCPP_USING_IF_EXISTS;
> > #endif
> 
> c++14 still refers to c99, c++17 refers to c11
> 
> struct timespec, TIME_UTC and timespec_get are also c++17

In cdefs.h __ISO_C_VISIBLE is set to 2011 when __cplusplus >= 201703
so building with std=c++17 should just work

> 
> > 
> > > 
> > > 
> > > Index: stdlib.h
> > > ===================================================================
> > > RCS file: /home/cvs/src/include/stdlib.h,v
> > > retrieving revision 1.76
> > > diff -u -p -u -p -r1.76 stdlib.h
> > > --- stdlib.h      10 May 2019 15:03:24 -0000      1.76
> > > +++ stdlib.h      16 Aug 2022 22:55:41 -0000
> > > @@ -223,7 +223,7 @@ unsigned long long
> > >    strtoull(const char *__restrict, char **__restrict, int);
> > >  #endif
> > >  
> > > -#if __ISO_C_VISIBLE >= 2011
> > > +#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103
> > >  void *
> > >   aligned_alloc(size_t, size_t);
> > >  #endif
> > > 
> > > 
> > 
> > 
> 
> 

Reply via email to