Bug 170662

Summary: [WTF] Annotate Seconds' member functions and operators with constexpr
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, buildbot, cdumez, cmarcelo, commit-queue, dbates, sam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Yusuke Suzuki 2017-04-09 17:41:49 PDT
[WTF] Annotate Seconds' member functions and operators with constexpr
Comment 1 Yusuke Suzuki 2017-04-09 17:44:51 PDT
Created attachment 306638 [details]
Patch
Comment 2 Yusuke Suzuki 2017-04-09 17:49:43 PDT
Created attachment 306639 [details]
Patch
Comment 3 Yusuke Suzuki 2017-04-09 18:01:32 PDT
Created attachment 306640 [details]
Patch
Comment 4 Daniel Bates 2017-04-09 19:12:45 PDT
Comment on attachment 306640 [details]
Patch

r=me
Comment 5 Yusuke Suzuki 2017-04-09 19:13:51 PDT
Comment on attachment 306640 [details]
Patch

Thanks!
Comment 6 Daniel Bates 2017-04-09 19:19:26 PDT
Comment on attachment 306640 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=306640&action=review

> Source/WTF/wtf/MathExtras.h:200
> +    return (value >= static_cast<double>(max)) ? max : ((value <= static_cast<double>(min)) ? min : static_cast<T>(value));

I take to that we must support one or more compilers that do not support C++14 extended constexpr and hence had to rewrite this function to have a single return statement.
Comment 7 Yusuke Suzuki 2017-04-09 19:29:23 PDT
Comment on attachment 306640 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=306640&action=review

>> Source/WTF/wtf/MathExtras.h:200
>> +    return (value >= static_cast<double>(max)) ? max : ((value <= static_cast<double>(min)) ? min : static_cast<T>(value));
> 
> I take to that we must support one or more compilers that do not support C++14 extended constexpr and hence had to rewrite this function to have a single return statement.

Right. At least, WebKitGTK+ needs to support GCC 4.9 now, which does not support C++14 relaxed constexpr.
Once C++14 relaxed constexpr is allowed, the above code will be much simplified.
Comment 8 WebKit Commit Bot 2017-04-09 19:41:07 PDT
Comment on attachment 306640 [details]
Patch

Clearing flags on attachment: 306640

Committed r215169: <http://trac.webkit.org/changeset/215169>
Comment 9 WebKit Commit Bot 2017-04-09 19:41:09 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Chris Dumez 2017-04-09 20:34:24 PDT
Thanks for doing this. I’ll use it in my next patch.