[PATCH 1/2] [gdb/build] Fix build with -std=c++11

Pedro Alves pedro@palves.net
Mon Nov 15 16:43:09 GMT 2021


On 2021-11-15 16:32, Simon Marchi wrote:
> On 2021-11-15 9:05 a.m., Pedro Alves wrote:

>> I suspect the risk of defining a compiler/library feature macro (I'd guess this
>> is undefined behavior land) like __cpp_sized_deallocation behind the compiler's back and
>> that going wrong is higher than ending up with misdetected declaration mismatches.
>>
> 

> I'm probably missing something, but couldn't we do just:
> 
> #if defined(__cpp_sized_deallocation)
> extern void operator delete (void *p, std::size_t) noexcept;
> extern void operator delete[] (void *p, std::size_t) noexcept;
> #endif
> 
> ?

That should work, yes.  Not sure it's a benefit, though?  As is, if we declare
the function incorrectly, we'll notice it via a redeclaration error on a modern
compiler.  With that change, we'd never notice such a mismatch.

Pedro Alves


More information about the Gdb-patches mailing list