For testing purposes only, I enable the intentional crash function of my application (testing my application in case of unexpected failures). For this, I use:
strcpy(0, "crash");
Of course, when parsing my code, Xcode reports a logical error Null pointer argument in call to string copy function
. I tried to wrap the violating code like this:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
strcpy(0, "crash");
#pragma clang diagnostic pop
But Xcode (v9.2 (9C40b)) is still complaining (this is not a warning, this is a logical error, I understand). Is there any other way for Xcode / clang not to mark this code? Is there a better way to cause crashes that can be protected from an Xcode / clang parsing error?
source
share