Review Request 130139: Set QT_NO_EXCEPTIONS for *.mm files
René J.V. Bertin
rjvbertin at gmail.com
Thu May 25 12:51:28 UTC 2017
> 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.
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`.
- 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170525/74f41d12/attachment.html>
More information about the Kde-frameworks-devel
mailing list