Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am intentionally using a category to override a method that I know is already implemented on a primary class. I know this is typically a sign of weak design-- please, no lectures-- but I can't subclass cleanly in this case. I know swizzling may also be an option.

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

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

Thanks.

like image 841
Ben Zotto Avatar asked Jan 19 '13 04:01

Ben Zotto


1 Answers

Unfortunately, there's no good answer.

The only linker-based solution is to pass -Wl,-w at link time; that is, tell Clang to pass the -w option through to the linker. This will suppress all linker warnings, potentially including ones you'd still like to see.

A higher-level workaround is to pipe the linker's output through grep -v. The details of that solution would tend to depend heavily on your shell and your build system.

like image 110
Quuxplusone Avatar answered Oct 21 '22 10:10

Quuxplusone