mattgallagher / CwlPreconditionTesting

A Mach exception handler that allows Swift precondition failures to be caught and tested.
ISC License
175 stars 46 forks source link

Intermittent: undeclared identifier 'BadInstructionException' #5

Closed abbeycode closed 8 years ago

abbeycode commented 8 years ago

Sometimes, but not all the time, this error comes up (use of undeclared identifier 'BadInstructionException'):

..../CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.m:34:13: error: use of undeclared identifier 'BadInstructionException'
    return [BadInstructionException catch_mach_exception_raise_state:exception_port exception:exception code:code codeCnt:codeCnt flavor:flavor old_state:old_state old_stateCnt:old_stateCnt new_state:new_state new_stateCnt:new_stateCnt];
            ^
1 error generated.

The Nimble team and I are looking into what's going on.

mattgallagher commented 8 years ago

I'm not sure if I've seen that exact problem occur but remember, the current CwlPreconditionTesting project does have one quirk/problem that might cause issues here:

Warning No. 2: if you're switching between the CwlPreconditionTesting_OSX and CwlPreconditionTesting_POSIX targets, Xcode (as of Xcode 7.2.1) will not detect the change and will not remove the old framework correctly so you'll need to clean your project otherwise the old framework will hang around.

This problem occurs because these two targets produce a result of the same name in the same location so Xcode doesn't clear properly when switching between the two – causing a range of annoying definitions problems.

abbeycode commented 8 years ago

Thanks, I had actually forgotten that, but at this point, I've removed the posix file from my branch of Nimble, so that's not causing it anymore. @jeffh thinks it looks like a Swift compiler bug, sometimes generating non-x86_64 binaries for x86_64 targets. I'm going to see if I can boil it down to a simple test case and file a bug. I'll close this issue if it turns out not to actually be a problem with this code.