As the compiler identifies as Clang, this code is not triggered.
For now, just adding:
#define MAME_DEVCB_GNUC_BROKEN_FRIEND 1
after the previous code, will make MAME compile.
At least until this point:
Objective-C compiling 3rdparty/bgfx/src/renderer_mtl.mm...
In file included from ../../../../../3rdparty/bgfx/src/renderer_mtl.mm:10:
../../../../../3rdparty/bgfx/src/renderer_mtl.h:365:12: error: instance method '-setLabel:' not found
(return type defaults to 'id') [-Werror,-Wobjc-method-access]