Bug 218381 - [WTF] Coding style issues in MediaTime.h
Summary: [WTF] Coding style issues in MediaTime.h
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-10-30 04:43 PDT by Philippe Normand
Modified: 2020-12-02 16:59 PST (History)
12 users (show)

See Also:


Attachments
Patch (7.50 KB, patch)
2020-10-30 04:51 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (5.79 KB, patch)
2020-11-16 02:27 PST, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (9.01 KB, patch)
2020-11-16 05:08 PST, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (8.84 KB, patch)
2020-11-16 10:39 PST, Philippe Normand
achristensen: review+
achristensen: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Normand 2020-10-30 04:43:37 PDT
ERROR: Source/WTF/wtf/MediaTime.h:34:  Alphabetical sorting problem.  [build/include_order] [4]                                                                                                                    
ERROR: Source/WTF/wtf/MediaTime.h:69:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:70:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:75:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:76:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:77:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:78:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:93:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:94:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:95:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:96:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:97:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:98:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:99:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fun
ction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                          ERROR: Source/WTF/wtf/MediaTime.h:100:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fu
nction definition out-of-line.  [build/webcore_export] [4]                        
ERROR: Source/WTF/wtf/MediaTime.h:101:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fu
nction definition out-of-line.  [build/webcore_export] [4]                                                                                                                                                         
ERROR: Source/WTF/wtf/MediaTime.h:109:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fu
nction definition out-of-line.  [build/webcore_export] [4]
ERROR: Source/WTF/wtf/MediaTime.h:110:  Inline functions should not be in classes annotated with WTF_EXPORT_PRIVATE. Remove the macro from the class and apply it to each appropriate method, or move the inline fu
nction definition out-of-line.  [build/webcore_export] [4]
Comment 1 Philippe Normand 2020-10-30 04:51:16 PDT
Created attachment 412731 [details]
Patch
Comment 2 Yusuke Suzuki 2020-10-30 21:03:10 PDT
Comment on attachment 412731 [details]
Patch

I think these functions are small and should be inline function. So defining in the header is better. Let's remove WTF_EXPORT_PRIVATE from the class, and annotate some of actually exported functions with WTF_EXPORT_PRIVATE.
Comment 3 Radar WebKit Bug Importer 2020-11-06 03:44:16 PST
<rdar://problem/71114972>
Comment 4 Philippe Normand 2020-11-16 02:27:21 PST
Created attachment 414209 [details]
Patch
Comment 5 Philippe Normand 2020-11-16 02:28:13 PST
(In reply to Yusuke Suzuki from comment #2)
> Comment on attachment 412731 [details]
> Patch
> 
> I think these functions are small and should be inline function. So defining
> in the header is better. Let's remove WTF_EXPORT_PRIVATE from the class, and
> annotate some of actually exported functions with WTF_EXPORT_PRIVATE.

Thanks for the review Yusuke, the patch is updated accordingly, hopefully :)
Comment 6 Philippe Normand 2020-11-16 05:08:47 PST
Created attachment 414216 [details]
Patch
Comment 7 Alex Christensen 2020-11-16 10:21:52 PST
Comment on attachment 414216 [details]
Patch

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

> Source/WTF/wtf/MediaTime.h:68
> +    inline MediaTime& operator+=(const MediaTime& rhs) { return *this = *this + rhs; }

I don't think the "inline" keyword is needed here
Comment 8 Philippe Normand 2020-11-16 10:39:46 PST
Created attachment 414252 [details]
Patch
Comment 9 Alex Christensen 2020-11-16 11:06:19 PST
Comment on attachment 414252 [details]
Patch

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

> Source/WTF/wtf/MediaTime.h:74
> +    inline bool operator<(const MediaTime& rhs) const { return compare(rhs) == LessThan; }

here either.

> Source/WTF/wtf/MediaTime.h:92
> +    inline bool isValid() const { return m_timeFlags & Valid; }

ditto

> Source/WTF/wtf/MediaTime.h:107
> +    inline const int64_t& timeValue() const { return m_timeValue; }

ditto
Comment 10 Philippe Normand 2020-11-17 04:19:28 PST
If no inline specifier remains in this patch I'm not sure why Yusuke r-'ed the initial patch.
Comment 11 Yusuke Suzuki 2020-12-02 16:59:00 PST
(In reply to Philippe Normand from comment #10)
> If no inline specifier remains in this patch I'm not sure why Yusuke r-'ed
> the initial patch.

In C++, inline attribute is not for inlining.
If you define function in header, compiler will decide whether inlines or not regardless of inline attribute is attached or not.

But unless LTO is enabled (WTF / JSC is not LTO enabled for now), function defined in cpp will not be inlined.

So the patch should define function in header, and inline attribute is not necessary.