[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-frameworks-devel
Subject:    Re: Review Request 130139: Set QT_NO_EXCEPTIONS for *.mm files
From:       René J.V. Bertin <rjvbertin () gmail ! com>
Date:       2017-05-25 13:20:05
Message-ID: 20170525132005.10655.68612 () mimi ! kde ! org
[Download RAW message or body]

--===============6652898491301653241==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit



> On May 25, 2017, 2:26 p.m., René J.V. Bertin wrote:
> > src/kdeinit/CMakeLists.txt, line 6
> > <https://git.reviewboard.kde.org/r/130139/diff/1/?file=496032#file496032line6>
> > 
> > I think you'll need to investigate this issue further first. I've been building \
> > (and patching) KInit since 5.16.0 or so and never run into this issue (neither \
> > have the other testers of my to-be-official MacPorts ports). 
> > I just checked (with AppleClang and macports-clang-4.0): all of KInit is built \
> > with `-fno-exceptions`, which has been the default for quite a while now (see \
> > KDECompilerSettings in the ECM). Yet for me QT_NO_EXCEPTIONS is NOT defined when \
> > I build kinit_mac.mm (nor when I include qlist.h and presumably not in the other \
> > files either). 
> > Which raises a number of questions:
> > 1. why is QT_NO_EXCEPTIONS not required on my end, but it is on your end (or with \
> > HomeBrew's build recipes)? 2. is this related to how Qt is built?
> > 3. why is only kinit_mac.mm concerned, or more generally, why would this be an \
> > ObjC++ issue? 
> > Either way, the real issue here lies in KDE's disabling of exceptions, and Qt's \
> > lacking magic in qglobal.h (around line 632 in Qt 5.8.0) that defines \
> > QT_NO_EXCEPTIONS as needed when GCC is being used. I haven't verified it that \
> > test can be extended to clang too (it works with GCC on Mac) but it seems much \
> > more reasonable to define QT_NO_EXCEPTIONS in the ECM than as suggested here on a \
> > case-by-case basis. 
> > -2 as is thus, as far as I'm concerned.
> 
> René J.V. Bertin wrote:
> To make things more interesting, here's the preprocessed QList method where the \
> error cited above originates: 
> ```
> template <typename T>
> inline typename QList<T>::iterator QList<T>::insert(iterator before, const T &t)
> {
> do { } while ((false) && (isValidIterator(before)));
> 
> int iBefore = int(before.i - reinterpret_cast<Node *>(p.begin()));
> Node *n = 0;
> if (d->ref.isShared())
> n = detach_helper_grow(iBefore, 1);
> else
> n = reinterpret_cast<Node *>(p.insert(iBefore));
> try {
> node_construct(n, t);
> } catch (...) {
> p.remove(iBefore);
> throw;
> }
> return n;
> }
> ```
> 
> which shows that even on my end I should be getting an error when compiling with \
> `-fno-exceptions`.

https://bugreports.qt.io/browse/QTBUG-61034


- René J.V.


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/130139/#review103241
-----------------------------------------------------------


On May 25, 2017, 1:37 p.m., Harald Fernengel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/130139/
> -----------------------------------------------------------
> 
> (Updated May 25, 2017, 1:37 p.m.)
> 
> 
> Review request for KDE Frameworks and René J.V. Bertin.
> 
> 
> Repository: kinit
> 
> 
> Description
> -------
> 
> Seems that some versions of clang default to build *.mm files with
> exceptions disabled, so compilation would fail with:
> 
> include/QtCore/qlist.h:522:9: error: cannot use 'throw' with exceptions disabled
> 
> 
> Diffs
> -----
> 
> src/kdeinit/CMakeLists.txt f00dd77baa95dbe7583e08760302951446aff387 
> 
> Diff: https://git.reviewboard.kde.org/r/130139/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Harald Fernengel
> 
> 


--===============6652898491301653241==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit




<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">  \
<tr>  <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/130139/">https://git.reviewboard.kde.org/r/130139/</a>
  </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On May 25th, 2017, 2:26 p.m. CEST, <b>René J.V. \
Bertin</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  


<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/130139/diff/1/?file=496032#file496032line6" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/kdeinit/CMakeLists.txt</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">6</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">  \
set_source_files_properties(kinit_mac.mm PROPERTIES COMPILE_DEFINITIONS \
QT_NO_EXCEPTIONS)</pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I \
think you'll need to investigate this issue further first. I've been building (and \
patching) KInit since 5.16.0 or so and never run into this issue (neither have the \
other testers of my to-be-official MacPorts ports).</p> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I \
just checked (with AppleClang and macports-clang-4.0): all of KInit is built with \
<code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: \
normal;margin: 0;line-height: inherit;">-fno-exceptions</code>, which has been the \
default for quite a while now (see KDECompilerSettings in the ECM). Yet for me \
QT_NO_EXCEPTIONS is NOT defined when I build kinit_mac.mm (nor when I include qlist.h \
and presumably not in the other files either).</p> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Which \
raises a number of questions: 1. why is QT_NO_EXCEPTIONS not required on my end, but \
it is on your end (or with HomeBrew's build recipes)? 2. is this related to how Qt is \
built? 3. why is only kinit_mac.mm concerned, or more generally, why would this be an \
ObjC++ issue?</p> <p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Either way, the real issue here lies in KDE's \
disabling of exceptions, and Qt's lacking magic in qglobal.h (around line 632 in Qt \
5.8.0) that defines QT_NO_EXCEPTIONS as needed when GCC is being used. I haven't \
verified it that test can be extended to clang too (it works with GCC on Mac) but it \
seems much more reasonable to define QT_NO_EXCEPTIONS in the ECM than as suggested \
here on a case-by-case basis.</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">-2 as is thus, as far \
as I'm concerned.</p></pre>  </blockquote>



 <p>On May 25th, 2017, 2:51 p.m. CEST, <b>René J.V. Bertin</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">To \
make things more interesting, here's the preprocessed QList method where the error \
cited above originates:</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;"><div class="codehilite" \
style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>template \
&lt;typename T&gt; inline typename QList&lt;T&gt;::iterator \
QList&lt;T&gt;::insert(iterator before, const T &amp;t) {
    do { } while ((false) &amp;&amp; (isValidIterator(before)));

    int iBefore = int(before.i - reinterpret_cast&lt;Node *&gt;(p.begin()));
    Node *n = 0;
    if (d-&gt;ref.isShared())
        n = detach_helper_grow(iBefore, 1);
    else
        n = reinterpret_cast&lt;Node *&gt;(p.insert(iBefore));
    try {
        node_construct(n, t);
    } catch (...) {
        p.remove(iBefore);
        throw;
    }
    return n;
}
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">which shows that even on my end I should be getting an \
error when compiling with <code style="text-rendering: inherit;color: \
#4444cc;padding: 0;white-space: normal;margin: 0;line-height: \
inherit;">-fno-exceptions</code>.</p></pre>  </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">https://bugreports.qt.io/browse/QTBUG-61034</p></pre> <br />




<p>- René J.V.</p>


<br />
<p>On May 25th, 2017, 1:37 p.m. CEST, Harald Fernengel wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;">  <tr>
  <td>

<div>Review request for KDE Frameworks and René J.V. Bertin.</div>
<div>By Harald Fernengel.</div>


<p style="color: grey;"><i>Updated May 25, 2017, 1:37 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kinit
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Seems that some versions of clang default to build *.mm files with \
exceptions disabled, so compilation would fail with:

include/QtCore/qlist.h:522:9: error: cannot use &#39;throw&#39; with exceptions \
disabled</pre>  </td>
 </tr>
</table>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/kdeinit/CMakeLists.txt <span style="color: \
grey">(f00dd77baa95dbe7583e08760302951446aff387)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/130139/diff/" style="margin-left: \
3em;">View Diff</a></p>






  </td>
 </tr>
</table>







  </div>
 </body>
</html>


--===============6652898491301653241==--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic