[PATCH 1/2] [gdb/build] Fix build with -std=c++11
Pedro Alves
pedro@palves.net
Mon Nov 15 18:42:41 GMT 2021
On 2021-11-15 18:23, Simon Marchi wrote:
> On 2021-11-15 11:43 a.m., Pedro Alves wrote:
>> 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
>>
>
> Arg, I got confused sorry (I thought about this last week and only
> typed it out today). I actually meant to make the definitions
> conditional, this patch basically:
If GDB links with something that is itself built with C++ >= 14 (e.g., say, libsource-highlight.so),
it can end up calling these operators, even if GDB itself is built with C++ 11. Can't the absence of
such operators defined in GDB still result in the ASAN mismatch errors described in the original
commit from Jan (5fff6115feae)?
Pedro Alves
More information about the Gdb-patches
mailing list