Skip to content

[Darwin] VerifyOrDie does not compile in ObjC code in src/platform/Darwin #39135

Open
@bzbarsky-apple

Description

@bzbarsky-apple

Reproduction steps

If I try to use VerifyOrDie or VerifyOrDieWithMsg in code in src/platform/Darwin that is Objective-C (not just in a .mm file, but also inside an actual Objective-C method, like - (void)dispatchConnectionComplete:(CBPeripheral *)peripheral, I get this error:

src/platform/Darwin/BleConnectionDelegateImpl.mm:340:9: error: declaration shadows a typedef in the global namespace [-Werror,-Wshadow]
  340 |         VerifyOrDieWithMsg(matchedLongDiscriminator != nil, Ble, "We should only have a peripheral without a discriminator if the NewConnection entrypoint took a BLE_CONNECTION_OBJECT, and in that case we would not be using onConnectionCompleteWithDiscriminator.");
      |         ^
../../../examples/all-clusters-app/linux/third_party/connectedhomeip/src/lib/support/CodeUtils.h:582:32: note: expanded from macro 'VerifyOrDieWithMsg'
  582 |     nlABORT_ACTION(aCondition, ChipLogError(aModule, aMessage, ##__VA_ARGS__))
      |                                ^
../../../examples/all-clusters-app/linux/third_party/connectedhomeip/src/lib/support/logging/TextOnlyLogging.h:96:37: note: expanded from macro 'ChipLogError'
   96 | #define ChipLogError(MOD, MSG, ...) ChipInternalLog(MOD, ERROR, MSG, ##__VA_ARGS__)
      |                                     ^
../../../examples/all-clusters-app/linux/third_party/connectedhomeip/src/lib/support/logging/TextOnlyLogging.h:439:30: note: expanded from macro 'ChipInternalLog'
  439 | #define ChipInternalLog(...) ChipPlatformLog(__VA_ARGS__)
      |                              ^
../../../examples/all-clusters-app/linux/third_party/connectedhomeip/src/platform/Darwin/Logging.h:36:9: note: expanded from macro 'ChipPlatformLog'
   36 |         ChipPlatformLogImpl(ChipPlatformLogger(MOD), ChipPlatformLogCategory(CAT), MSG, ##__VA_ARGS__); /* os_log() */             \
      |         ^
../../../examples/all-clusters-app/linux/third_party/connectedhomeip/src/platform/Darwin/Logging.h:90:15: note: expanded from macro 'ChipPlatformLogImpl'
   90 |         using os_log_t = ::os_log_t __unsafe_unretained;                                                                           \
      |               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.3.sdk/usr/include/os/log.h:25:1: note: previous declaration is here
   25 | OS_OBJECT_DECL(os_log);
      | ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.3.sdk/usr/include/os/object.h:144:3: note: expanded from macro 'OS_OBJECT_DECL'
  144 |                 OS_OBJECT_DECL_IMPL(name, NSObject, <NSObject>)
      |                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.3.sdk/usr/include/os/object.h:134:33: note: expanded from macro 'OS_OBJECT_DECL_IMPL'
  134 |                                 * OS_OBJC_INDEPENDENT_CLASS name##_t
      |                                                             ^
<scratch space>:55:1: note: expanded from here
   55 | os_log_t
      | ^
1 error generated.

which is odd, because ChipPlatformLogImpl does pragma bits to push an ignore of -Wshadow around the relevant bit....

Platform

darwin

Platform Version(s)

No response

Type

Manually tested with SDK

(Optional) If manually tested please explain why this is only manually tested

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions