RESOLVED FIXED Bug 44870
Modify ASSERT_UNUSED and UNUSED_PARAM similar to Qt's Q_UNUSED
https://bugs.webkit.org/show_bug.cgi?id=44870
Summary Modify ASSERT_UNUSED and UNUSED_PARAM similar to Qt's Q_UNUSED
Csaba Osztrogonác
Reported 2010-08-30 07:29:45 PDT
Q_UNUSED is more specific than a simple (void)x , so ASSERT_UNUSED should call Q_UNUSED for Qt builds to make ICC and RVCT happy. ASSERT_UNUSED: -------------- #define ASSERT_UNUSED(variable, assertion) ((void)variable) Q_UNUSED: --------- #if defined(Q_CC_INTEL) && !defined(Q_OS_WIN) || defined(Q_CC_RVCT) template <typename T> inline void qUnused(T &x) { (void)x; } # define Q_UNUSED(x) qUnused(x); #else # define Q_UNUSED(x) (void)x; #endif
Attachments
proposed patch (1.06 KB, patch)
2010-08-30 07:36 PDT, Csaba Osztrogonác
no flags
proposed patch (1.25 KB, patch)
2010-08-30 08:21 PDT, Csaba Osztrogonác
no flags
proposed patch (1.86 KB, patch)
2010-08-30 09:45 PDT, Csaba Osztrogonác
no flags
proposed patch (1.83 KB, patch)
2010-08-31 02:36 PDT, Csaba Osztrogonác
darin: review+
Csaba Osztrogonác
Comment 1 2010-08-30 07:36:16 PDT
Created attachment 65912 [details] proposed patch I didn't test it locally, please let EWS to do it before review.
Antonio Gomes
Comment 2 2010-08-30 07:42:00 PDT
Comment on attachment 65912 [details] proposed patch r=me Please set cq+ or manually checkin when bots gets green.
Early Warning System Bot
Comment 3 2010-08-30 07:55:15 PDT
Csaba Osztrogonác
Comment 4 2010-08-30 08:05:16 PDT
Comment on attachment 65912 [details] proposed patch patch is incorrect, fix is coming soon
Csaba Osztrogonác
Comment 5 2010-08-30 08:21:28 PDT
Created attachment 65915 [details] proposed patch - include added - incorrect paranthesis removed - tested locally :)
Darin Adler
Comment 6 2010-08-30 09:03:53 PDT
What about UNUSED_PARAM? What about non-Qt platforms? I’d like to see both ASSERT_UNUSED and UNUSED_PARAM use the best technique available. Probably they would just do it directly instead of using Q_UNUSED.
Csaba Osztrogonác
Comment 7 2010-08-30 09:45:21 PDT
Created attachment 65925 [details] proposed patch UNUSED_PARAM use Q_UNUSED too
Csaba Osztrogonác
Comment 8 2010-08-30 09:48:08 PDT
(In reply to comment #6) > What about UNUSED_PARAM? What about non-Qt platforms? > > I’d like to see both ASSERT_UNUSED and UNUSED_PARAM use the best technique available. Probably they would just do it directly instead of using Q_UNUSED. Do you mean we should copy and use the logic of Q_UNUSED instead of using Q_UNUSED?
Eric Seidel (no email)
Comment 9 2010-08-30 10:10:35 PDT
Darin Adler
Comment 10 2010-08-30 10:12:11 PDT
(In reply to comment #8) > (In reply to comment #6) > > What about UNUSED_PARAM? What about non-Qt platforms? > > > > I’d like to see both ASSERT_UNUSED and UNUSED_PARAM use the best technique available. Probably they would just do it directly instead of using Q_UNUSED. > > Do you mean we should copy and use the logic of Q_UNUSED instead of using Q_UNUSED? Yes. We’d want to do that if there are any non-Qt ports that also work with the compilers that require the alternate technique. And if we did that, then we could avoid having any Qt-specific code. In the end, I don’t care whether we use Q_UNUSED or not, I just want the macros to work well for everyone.
Csaba Osztrogonác
Comment 11 2010-08-31 02:36:55 PDT
Created attachment 66023 [details] proposed patch I refactored ASSERT_UNUSED and UNUSED_PARAM to have similar behavior as Qt's Q_UNUSED. If this patch will be landed, we won't need to use Q_UNUSED anymore.
Darin Adler
Comment 12 2010-08-31 08:11:15 PDT
Comment on attachment 66023 [details] proposed patch Formatting isn’t quite right. We normally put the "&" next to the "T". We normally don’t put a space after the keyword "template". And the names of the functions aren't quite right either. But I think we can live with it like this, so r=me
Csaba Osztrogonác
Comment 13 2010-08-31 09:56:10 PDT
(In reply to comment #12) > (From update of attachment 66023 [details]) > Formatting isn’t quite right. We normally put the "&" next to the "T". We normally don’t put a space after the keyword "template". And the names of the functions aren't quite right either. But I think we can live with it like this, so r=me I fixed style errors ( T& and template<...> ), and then landed it: http://trac.webkit.org/changeset/66489
Note You need to log in before you can comment on or make changes to this bug.