Suppress linker warning: "Meta method X in category from Y overrides method from class to Z"

I intentionally use a category to override a method that, as I know, is already implemented in the main class. I know that this is usually a sign of poor design - please, no lectures - but I cannot subclass purely in this case. I know swizzling could also be an option.

But now, how can I suppress this warning? llvm issues a compiler warning that I can disable ( diagnostic ignored "-Wobjc-protocol-method-implementation" ). But then the linker also complains.

This question asks a similar question, but it is looking for a different answer. How can I tell the linker not to complain?

Thanks.

+7
source share
1 answer

Unfortunately, there is no good answer.

The only linker-based solution is to pass -Wl,-w during the connection; that is, tell Clan to pass the -w option to the linker. This will suppress all linker warnings, potentially including the ones you would still like to see.

A higher level workaround is to pass linker output through grep -v . The details of this solution will largely depend on your shell and your build system.

+1
source

All Articles