Re: [PATCH] Rename block.{h,c} to gdb-block.{h, c}

Saagar Jha
2020-09-07T05:27:32Z

Ok, so I was tinkering around with Travis some more (trying to fix other thing, which happened to be spurious) and got an email that the build passed; it turns out that Apple shipped that header for just a couple weeks until LLVM realized that this would break things: https://github.com/llvm/llvm-project/commit/19bc9ea480b60b607a3e303f20c7a3a2ea553369. Since they’ve rolled that out for now and Apple has pulled that into Xcode the build is green again on macOS, so there’s no need for this patch anymore. Travis should email me if the build breaks again, so hopefully the build gets fixed quicker now that it’s checked more often than me me taking a weekend looking at getting GDB working again, making some progress, then putting it down again :P

For completeness’s sake, here’s a sample error from the build:

In file included from common-debug.cc:20:
In file included from ./common-defs.h:123:
In file included from ./ptid.h:35:
In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:512:
In file included from ./../gdb/Block.h:23:
In file included from ./../gdb/dictionary.h:26:
In file included from ./../gdb/symfile.h:24:
In file included from ./../gdb/symtab.h:23:
In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/array:111:
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:1503:81: error: expected '(' for function-style cast or type construction
return _VSTD::__search<typename add_lvalue_reference<_BinaryPredicate>::type>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:1503:19: error: no member named '__search' in namespace 'std::__1'
return _VSTD::__search<typename add_lvalue_reference<_BinaryPredicate>::type>
~~~~~~~^

You can see it go off the rails when <functional> includes GDB’s block.h instead of the system’s Block.h.

> On Sep 6, 2020, at 19:53, Kevin Buettner <kevinb@redhat.com> wrote:
>
> On Sun, 6 Sep 2020 18:47:33 -0700
> Saagar Jha <saagar@saagarjha.com> wrote:
>
>> macOS, by default, uses a case-insensitive filesystem and ships with a
>> header in its SDK (as part of Xcode) at /usr/include/Block.h.
>> <functional> from Xcode 12's SDK for macOS 11 includes this file but
>> due to GDB's compilation flags ends up including gdb/block.h. The
>> simplest solution to fix the resulting build errors is to just rename it
>> to something that doesn't conflict.
>
> As you may have gathered in my reply to Simon, I'm not (yet) in favor
> of your renaming changes, but I would like to understand it better.
> Could you provide additional details about where things go wrong?
> I.e. please show the error messages and code snippets from the
> relevant header files...
>
> Thanks,
>
> Kevin
>