> Yeah, I’m not sure about this either. It strikes me as a bit suspect, > but I don’t know that the alternatives are going to be any better. > > We could disable the warning: > > #pragma clang diagnostic push > #pragma clang diagnostic ignored "-Wobjc-method-access" > if ([win respondsToSelector: @selector(setTabbingMode:)]) > [win setTabbingMode: NSWindowTabbingModeDisallowed]; > #pragma clang diagnostic pop > > which is, I think, the right thing to do, but that’s quite messy > looking, and I suspect we’ll have to do the same for the gcc warning. > I don’t know if we’d then have to do some #ifdef stuff to separate the > clang and gcc stuff. This has the potential to get REALLY messy. > It's possible to encapsulate pragmas into preprocessor macros using the _Pragma construct. In fact, config.h contains similar stuff, c.f. _GL_INLINE_HEADER_BEGIN and _GL_INLINE_HEADER_END. Another possibility is to cast `win` to `id`, which I’d guess would > look like: > > [(id)win setTabbingMode: NSWindowTabbingModeDisallowed]; > I still get the same warning, so this is not a solution. By the way, while digging around I came across a lot of stuff saying > `@selector(setTabbingMode)` should give a warning if `setTabbingMode` > doesn’t exist. Are you seeing one? > No, no warning is issued about that. I believe that there are a number of #ifdef:s that could be rewritten in this way, so we need something ergonomically. (If we could get rid of all such ifdef:s there would not be a need for OS-version specific binaries.) Given the options, I would say that a solution along the lines of _GL_INLINE_HEADER_BEGIN would be best. The pros are: * All the messy bits can be located in one place, and it can easily be updated to match future compiler versions. (Should some compiler start to warn about, say, `@selector(setTabbingMode)`, that too could be incorporated in the macros.) * There is a natural location to place documentation and to describe the situation * In the code that use the macros, there is a signal to the reader that something special is going on * It's possible to write formal tests, ensuring the macros work as intended. Unlike _GL_INLINE_HEADER_BEGIN, we should not use a leading underscore, as such identifiers are reserved for the compiler itself. Maybe NS_SILENCE_MISSING_METHOD_WARNING_BEGIN and -_END? The end result would look like: NS_SILENCE_MISSING_METHOD_WARNING_BEGIN if ([win respondsToSelector: @selector(setTabbingMode:)]) [win setTabbingMode: NSWindowTabbingModeDisallowed]; NS_SILENCE_MISSING_METHOD_WARNING_END -- Anders