ıɾuǝʞ
ıɾuǝʞ

Reputation: 2849

Disable -Werror via pragma clang diagnostic

Using -Werror to treat all warning as errors, I don't want to suppress a deprecated declaration warning :

#pragma clang diagnostic push
#pragma clang diagnostic ignore "-Wdeprecated-declarations"
    SKPayment *myPayment = [SKPayment paymentWithProductIdentifier:completeName];
    [[SKPaymentQueue defaultQueue] addPayment:myPayment];
#pragma clang diagnostic pop

How to do it ?

Upvotes: 4

Views: 2580

Answers (1)

ıɾuǝʞ
ıɾuǝʞ

Reputation: 2849

Ok, found it, just use warning instead of ignore :

#pragma clang diagnostic push
#pragma clang diagnostic warning "-Wdeprecated-declarations"
    SKPayment *myPayment = [SKPayment paymentWithProductIdentifier:completeName];
    [[SKPaymentQueue defaultQueue] addPayment:myPayment];
#pragma clang diagnostic pop

Now, I still use this deprecated API, compilation passes with -Werror and warning is still present (remove this API use is kept in mind).

Upvotes: 7

Related Questions