[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-frameworks-devel
Subject: Re: Review Request 114897: Make KDE_ENABLE_EXCEPTIONS a list
From: "Alex Merry" <kde () randomguy3 ! me ! uk>
Date: 2014-01-07 17:57:03
Message-ID: 20140107175703.27045.32984 () probe ! kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On Jan. 7, 2014, 4:55 p.m., Stephen Kelly wrote:
> > Why is -UQT_NO_EXCEPTIONS needed?
Hrm. After some investigation: I'm not entirely sure. The simplest answer \
is "that's what qmake does" - defines QT_NO_EXCEPTIONS exactly when \
exceptions are disabled (note that exceptions are disabled by default for \
Qt itself, but enabled by default for all other code, including tests in Qt \
and applications using qmake as their build system).
You would have thought that enabling this only for the headers in Qt (but \
not for the library itself) would be dangerous - for example, QException is \
declared, but its methods will not be defined if Qt was not compiled with \
exception support.
As far as I can see, the only useful behaviour you get from making \
QT_NO_EXCEPTIONS match the compiler flags, rather than Qt's compilation \
flags, is that you can get QVERIFY_EXCEPTION_THROWN from QTest even when Qt \
was compiled without exceptions. But in other regards, I think there is \
the potential for some weird behaviour if QT_NO_EXCEPTIONS does not match \
how Qt was compiled.
- Alex
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/114897/#review46984
-----------------------------------------------------------
On Jan. 7, 2014, 4:52 p.m., Alex Merry wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/114897/
> -----------------------------------------------------------
>
> (Updated Jan. 7, 2014, 4:52 p.m.)
>
>
> Review request for Build System, KDE Frameworks and Stephen Kelly.
>
>
> Repository: extra-cmake-modules
>
>
> Description
> -------
>
> Make KDE_ENABLE_EXCEPTIONS a list
>
> When KDE_ENABLE_EXCEPTIONS contains two arguments, they are currently a
> single string containing those space-separated arguments. It can thus
> be used as
> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE_ENABLE_EXCEPTIONS}")
> However, the proper way to set compile flags these days is to use
> add_compile_options, as in
> add_compile_options(${KDE_ENABLE_EXCEPTIONS})
> which requires KDE_ENABLE_EXCEPTIONS to be a list.
>
> Note that this change means that setting CMAKE_CXX_FLAGS like above NO
> LONGER WORKS (as you will get the argument
> -fexceptions;-UQT_NO_EXCEPTIONS added for GCC and Clang).
>
>
> Diffs
> -----
>
> kde-modules/KDECompilerSettings.cmake \
> 72824e166d03dcc2d089814dc121f08ba998974a
> Diff: https://git.reviewboard.kde.org/r/114897/diff/
>
>
> Testing
> -------
>
> ThreadWeaver compiles under GCC on Linux if (and only if) I change the \
> src/CMakeLists.txt file to use add_compile_options instead of setting \
> CMAKE_CXX_FLAGS.
>
> Thanks,
>
> Alex Merry
>
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px \
#c9c399 solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/114897/">https://git.reviewboard.kde.org/r/114897/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; \
padding-left: 10px;"> <p style="margin-top: 0;">On January 7th, 2014, 4:55 \
p.m. UTC, <b>Stephen Kelly</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;">Why is \
-UQT_NO_EXCEPTIONS needed?</pre> </blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Hrm. After \
some investigation: I'm not entirely sure. The simplest answer is \
"that's what qmake does" - defines QT_NO_EXCEPTIONS exactly \
when exceptions are disabled (note that exceptions are disabled by default \
for Qt itself, but enabled by default for all other code, including tests \
in Qt and applications using qmake as their build system).
You would have thought that enabling this only for the headers in Qt (but \
not for the library itself) would be dangerous - for example, QException is \
declared, but its methods will not be defined if Qt was not compiled with \
exception support.
As far as I can see, the only useful behaviour you get from making \
QT_NO_EXCEPTIONS match the compiler flags, rather than Qt's compilation \
flags, is that you can get QVERIFY_EXCEPTION_THROWN from QTest even when Qt \
was compiled without exceptions. But in other regards, I think there is \
the potential for some weird behaviour if QT_NO_EXCEPTIONS does not match \
how Qt was compiled.</pre> <br />
<p>- Alex</p>
<br />
<p>On January 7th, 2014, 4:52 p.m. UTC, Alex Merry wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px \
black solid;"> <tr>
<td>
<div>Review request for Build System, KDE Frameworks and Stephen \
Kelly.</div> <div>By Alex Merry.</div>
<p style="color: grey;"><i>Updated Jan. 7, 2014, 4:52 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
extra-cmake-modules
</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;">Make KDE_ENABLE_EXCEPTIONS a list
When KDE_ENABLE_EXCEPTIONS contains two arguments, they are currently a
single string containing those space-separated arguments. It can thus
be used as
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
${KDE_ENABLE_EXCEPTIONS}") However, the proper way to set compile \
flags these days is to use add_compile_options, as in
add_compile_options(${KDE_ENABLE_EXCEPTIONS})
which requires KDE_ENABLE_EXCEPTIONS to be a list.
Note that this change means that setting CMAKE_CXX_FLAGS like above NO
LONGER WORKS (as you will get the argument
-fexceptions;-UQT_NO_EXCEPTIONS added for GCC and Clang).</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing \
</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;">ThreadWeaver compiles under GCC on Linux if (and only if) I \
change the src/CMakeLists.txt file to use add_compile_options instead of \
setting CMAKE_CXX_FLAGS.</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>kde-modules/KDECompilerSettings.cmake <span style="color: \
grey">(72824e166d03dcc2d089814dc121f08ba998974a)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/114897/diff/" \
style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic