From jason at redhat.com Fri Apr 13 19:41:46 2007 From: jason at redhat.com (Jason Merrill) Date: Fri, 13 Apr 2007 15:41:46 -0400 Subject: Explicit catch of forced unwind In-Reply-To: <44FB6A59.30407@codesourcery.com> References: <44F8ABCF.5030007@redhat.com> <44FB6A59.30407@codesourcery.com> Message-ID: <461FDCFA.6060909@redhat.com> Mark Mitchell wrote: > Jason Merrill wrote: >> I would like to add a magic class __forced_unwind to the common ABI, >> in order to allow users to handle forced unwind differently from >> normal exceptions. This would work similarly to the >> __foreign_exception class already in the ABI. I recently realized that I never followed up on this. > I think this is a good idea. Would you like to propose a patch to the > C++ ABI HTML document? In addition to the new class, I think you will > have to adjust the forced-unwinding specification to say that it is not > possible to catch such an exception Hmm? I'm proposing to catch it explicitly. Do you mean that you don't think it's necessary for catch (...) to catch forced unwind if we provide a means to catch it separately? > and which routine is responsible for > setting things up so that the active exception appears to have this type. My current implementation doesn't do this, it just changes the personality function to magically match a forced unwind with the __forced_unwind type. Jason From mark at codesourcery.com Sun Apr 15 20:51:05 2007 From: mark at codesourcery.com (Mark Mitchell) Date: Sun, 15 Apr 2007 13:51:05 -0700 Subject: Explicit catch of forced unwind In-Reply-To: <461FDCFA.6060909@redhat.com> References: <44F8ABCF.5030007@redhat.com> <44FB6A59.30407@codesourcery.com> <461FDCFA.6060909@redhat.com> Message-ID: <46229039.5000103@codesourcery.com> Jason Merrill wrote: >> I think this is a good idea. Would you like to propose a patch to the >> C++ ABI HTML document? In addition to the new class, I think you will >> have to adjust the forced-unwinding specification to say that it is >> not possible to catch such an exception > > Hmm? I'm proposing to catch it explicitly. Do you mean that you don't > think it's necessary for catch (...) to catch forced unwind if we > provide a means to catch it separately? I forget the exact context, so I'm not sure what I meant. :-) However, I think catching the unwind exception explicitly makes sense, and I do continue to think that "catch (...)" ought to catch the unwind exception. > My current implementation doesn't do this, it just changes the > personality function to magically match a forced unwind with the > __forced_unwind type. I see; that's clever. I also see that your proposed changes to the specification forbid users from poking at the exception object, presumably to permit this implementation technique. However, the "accessed in any way" language would also seem to forbid rethrowing the exception (via "throw;"). Did you meant to forbid that? If so, why? -- Mark Mitchell CodeSourcery mark at codesourcery.com (650) 331-3385 x713 From jason at redhat.com Sun Apr 15 23:31:25 2007 From: jason at redhat.com (Jason Merrill) Date: Sun, 15 Apr 2007 19:31:25 -0400 Subject: Explicit catch of forced unwind In-Reply-To: <46229039.5000103@codesourcery.com> References: <44F8ABCF.5030007@redhat.com> <44FB6A59.30407@codesourcery.com> <461FDCFA.6060909@redhat.com> <46229039.5000103@codesourcery.com> Message-ID: <4622B5CD.9020009@redhat.com> Mark Mitchell wrote: > Jason Merrill wrote: >> My current implementation doesn't do this, it just changes the >> personality function to magically match a forced unwind with the >> __forced_unwind type. > > I see; that's clever. I also see that your proposed changes to the > specification forbid users from poking at the exception object, > presumably to permit this implementation technique. Yes. > However, the "accessed in any way" language would also seem to forbid > rethrowing the exception (via "throw;"). Did you meant to forbid that? > If so, why? No, rethrowing does not access the exception, just passes it along. This is the same restriction that was already present for foreign exceptions. Jason From mark at codesourcery.com Mon Apr 16 00:15:04 2007 From: mark at codesourcery.com (Mark Mitchell) Date: Sun, 15 Apr 2007 17:15:04 -0700 Subject: [c++-pthreads] Re: Explicit catch of forced unwind In-Reply-To: <4622B5CD.9020009@redhat.com> References: <44F8ABCF.5030007@redhat.com> <44FB6A59.30407@codesourcery.com> <461FDCFA.6060909@redhat.com> <46229039.5000103@codesourcery.com> <4622B5CD.9020009@redhat.com> Message-ID: <4622C008.5050006@codesourcery.com> Jason Merrill wrote: >> However, the "accessed in any way" language would also seem to forbid >> rethrowing the exception (via "throw;"). Did you meant to forbid that? >> If so, why? > > No, rethrowing does not access the exception, just passes it along. This > is the same restriction that was already present for foreign exceptions. OK; in that case, your proposed change seems fine to me. Does anyone else object? If nobody speaks up in a week, I'll check the change into the ABI document. Thanks, -- Mark Mitchell CodeSourcery mark at codesourcery.com (650) 331-3385 x713