PLCrashReporter source code migration error 'Case value is not a constant expression'

274 Views Asked by At

I'd like to integrate PLCrashReporter to my static library project and generate a .framework with it embedded.

So far I was following the same hierarchy importing code from their source code XCode project. Drag and drop files to my XCode project. A lot of files needed the linker flag since they don't use ARC but I am.

No I got stuck in a problem I don't quite understand, maybe because of my low level limited experience mixed with Objective-C.

So in the PLCrashSignalHandler.mm file there is a switch with two cases and both stops compile with error 'Case value is not a constant expression'.

switch ((uintptr_t) (next->value().action.sa_handler)) {
                case ((uintptr_t) SIG_IGN):
                    /* Ignored */
                    handled = true;
                    break;

                case ((uintptr_t) SIG_DFL):
                    /* Default handler should be run, be we have no mechanism to pass through to
                     * the default handler; mark the signal as unhandled. */
                    handled = false;
                    break;

                default:
                    /* Handler registered, execute it */
                    next->value().action.sa_handler(signo);
                    handled = true;
                    break;
            }

case ((uintptr_t) SIG_IGN): and case ((uintptr_t) SIG_DFL): stop build with the above error.

Their source code is properly building the project so I'm curious what I miss here.

Thanks.

0

There are 0 best solutions below