<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Book Antiqua";
        panose-1:2 4 6 2 5 3 5 3 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Book Antiqua","serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D'>Just a thought.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D'>Since an implementation that does not support Exception Handling cannot by definition be ISO C++ compliant, a reasonable compromise to calling ‘</span><span style='font-family:"Courier New";color:black'>abort</span><span style='font-family:"Book Antiqua","serif";color:#1F497D'>’ might be to call ‘</span><span style='font-family:"Courier New";color:black'>terminate</span><span style='font-family:"Book Antiqua","serif";color:#1F497D'>’ wherever a ‘</span><span style='font-family:"Courier New";color:black'>throw</span><span style='font-family:"Book Antiqua","serif";color:#1F497D'>’ is expected from the Standard library.  Since a program that does not support exception handling cannot have any ‘</span><span style='font-family:"Courier New";color:black'>catch</span><span style='font-family:"Book Antiqua","serif";color:#1F497D'>’ clauses, calling ‘</span><span style='font-family:"Courier New";color:black'>terminate</span><span style='font-family:"Book Antiqua","serif";color:#1F497D'>’ would in effect have the same semantic effect as a ‘</span><span style='font-family:"Courier New";color:black'>throw</span><span style='font-family:"Book Antiqua","serif";color:#1F497D'>’ where no ‘</span><span style='font-family:"Courier New";color:black'>catch</span><span style='font-family:"Book Antiqua","serif";color:#1F497D'>’ exists.  This would also allow the programmer to use ‘</span><span style='font-family:"Courier New";color:black'>set_terminate</span><span style='font-family:"Book Antiqua","serif";color:#1F497D'>’ in an approximation to the Standard.  If this not set, it will default to ‘</span><span style='font-family:"Courier New";color:black'>abort</span><span style='font-family:"Book Antiqua","serif";color:#1F497D'>’ anyway.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D'>Certainly the need for a good C++ library for embedded systems is essential, and unfortunately the impact of EH keeps a lot of programmers using C instead.  For our implementation I build the libraries with EH disabled, though I do keep RTTI enabled.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D'>All the best,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D'>            MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> cfe-dev [mailto:cfe-dev-bounces@lists.llvm.org] <b>On Behalf Of </b>Asiri Rathnayake via cfe-dev<br><b>Sent:</b> 28 November 2015 21:20<br><b>To:</b> Eric Lasota<br><b>Cc:</b> cfe-dev@lists.llvm.org<br><b>Subject:</b> Re: [cfe-dev] [RFC][libcxx] Fix and maintain the no-exceptions build of libcxx<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>Hi Eric,<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p><div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>If you're going to change exceptional cases to call abort though, then it'd be good to make other cases to be consistent with that approach, like vector's __throw_length_error and __throw_out_of_range, regex's __throw_regex_error, and possibly others.<o:p></o:p></p></div></blockquote><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>The initial patch [1] only proposes the framework for fixing the tests and updating the library sources. I kept it minimal to make the review easier. I have a giant local patch that fixes the rest of the tests (removes the XFAILS) and the remaining library sources. And yes, vector's __throw_length_error, __throw_out_of_range and regex's __throw_regex_error are all updated in it (and many other places).<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I'm still waiting for the approval of this initial patch so that I can upstream the rest.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Best,<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>- Asiri<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>[1] <a href="http://reviews.llvm.org/D14653">http://reviews.llvm.org/D14653</a> <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Fri, Nov 27, 2015 at 7:03 AM, Asiri Rathnayake <<a href="mailto:asiri.rathnayake@gmail.com" target="_blank">asiri.rathnayake@gmail.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal>Hello,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Asserts getting optimized away is a problem, as then an exceptional code path will simply ignore the error and continue. Of course, one can argue that an exceptional state in a no-exceptions library is something that is OK to be ignored.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>In my latest patch [1], the user has the option to override the default abort behaviour by providing a custom __libcxx_noexceptions_abort() function. I think with this mechanism you can achieve the old behaviour if desired.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Cheers,<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>- Asiri<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>[1] <a href="http://reviews.llvm.org/D14653" target="_blank">http://reviews.llvm.org/D14653</a><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Thu, Nov 26, 2015 at 5:00 PM, via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p><div><div><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>Wouldn’t the better thing to do be to assert rather than call abort (like vector’s exceptions already do, for instance)?  One important use case of no-exception builds is to completely optimize out throwing paths and the checks leading to them, which wouldn’t happen if the exceptional path called abort.<o:p></o:p></span></p></div></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>