How to suppress -Wno-protocol per file

I have implementation of Objective-C Protocol which forward all protocol's methods to another target. Everething is fine except that compiler warns that this Class doesn implement protocol's method. I am trying suppress this warning using #pragma diagnostic:

//Header file
@protocol A

@interface AImpl : NSObject<A> {
    id<A> myItems;

//Implementation file:
#pragma GCC diagnostic push
#pragma clang diagnostic push

#pragma GCC diagnostic ignored "-Wno-protocol"
#pragma clang diagnostic ignored "-Wno-protocol"

@implementation AImpl
- (void)forwardInvocation:(NSInvocation *)invocation {
SEL selector = [invocation selector];

    if ([myItems respondsToSelector:selector]) {
    [invocation invokeWithTarget:myItems];
} else {
    [super forwardInvocation:invocation];

#pragma clang diagnostic pop
#pragma GCC diagnostic pop

But compiler warns that "Unknown warning group '-Wno-protocol'"


You've 3 immediate approaches:

1) you can do this instead:

#pragma GCC diagnostic ignored "-Wprotocol"
#pragma clang diagnostic ignored "-Wprotocol"

you specify the group to disable using the pragma, rather than the compiler flag to set/alter.

2) or you can correct the issue like so (assuming you are not declaring a root class):

@interface AImpl : NSObject<A>
  id<NSObject,A> myItems;

3) or you can specify the setting on a per-file basis in Xcode's Project > Target > Build Phases > Compile Sources > Compiler Flags = "-Wno-protocol"

I'd go with #2.

Need Your Help

Why can't I use filter my WHERE clause on a CASE statement column in SQL Server?

sql sql-server case where

In my select statement there is a CASE WHEN THEN ELSE END AS statement that I am not able to filter on in my WHERE clause. I do not see why this would be an issue, could someone shed some light?

Dynamic Button Onclick Not Working

php html ajax onclick

I am creating a table with information with ajax, echoing it with php. As last option I want to add edit/delete buttons that will fill empty textfields with information based on row ID of the produ...