Re: [webkit-dev] -Wreturn-type and -Wredundant-move reminders

2021-10-29 Thread Michael Catanzaro via webkit-dev
On Fri, Oct 29 2021 at 03:06:17 PM -0700, Myles Maxfield 
 wrote:

Will GTK/WPE EWS catch these errors?


Currently no, but they will once we solve 
https://bugs.webkit.org/show_bug.cgi?id=155047.



___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] -Wreturn-type and -Wredundant-move reminders

2021-10-29 Thread Myles Maxfield via webkit-dev



> On Oct 19, 2021, at 1:15 PM, Michael Catanzaro via webkit-dev 
>  wrote:
> 
> Hi devs,
> 
> A reminder about this common idiom:
> 
> switch (...) {
> case Foo:
>   return ...;
> case Bar:
>   return ...;
> }
> RELEASE_ASSERT_NOT_REACHED();
> 
> When it's intended that the code always returns inside the switch statement, 
> the RELEASE_ASSERT_NOT_REACHED() is required to avoid tripping GCC's 
> -Wreturn-type. If you forget it, I or somebody else will wind up adding it 
> later to avoid the warning. Clang does not warn here, and this is the most 
> common type of warning I clean up, so please don't forget! :) This warning is 
> useful in other situations, and it seems nicer to placate GCC than to disable 
> it.
> 
> I'll sneak in another reminder: "return WTFMove()" is almost always not 
> needed. Clang warns only if the move prevents return value optimization, but 
> GCC will always warn if it detects the move is unneeded.

Will GTK/WPE EWS catch these errors?

> 
> Have a nice day,
> 
> Michael
> 
> 
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] -Wreturn-type and -Wredundant-move reminders

2021-10-19 Thread Michael Catanzaro via webkit-dev
On Tue, Oct 19 2021 at 01:43:19 PM -0700, Ryosuke Niwa 
 wrote:

Can we add a style checker rule to detect at least simple cases?


I think detecting this pattern without false positives would be pretty 
tough. Requires too much knowledge of the semantics of the code.


Michael


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] -Wreturn-type and -Wredundant-move reminders

2021-10-19 Thread Ryosuke Niwa via webkit-dev
On Tue, Oct 19, 2021 at 1:15 PM Michael Catanzaro via webkit-dev <
webkit-dev@lists.webkit.org> wrote:

> A reminder about this common idiom:
>
> switch (...) {
> case Foo:
> return ...;
> case Bar:
> return ...;
> }
> RELEASE_ASSERT_NOT_REACHED();
>
> When it's intended that the code always returns inside the switch
> statement, the RELEASE_ASSERT_NOT_REACHED() is required to avoid
> tripping GCC's -Wreturn-type. If you forget it, I or somebody else will
> wind up adding it later to avoid the warning. Clang does not warn here,
> and this is the most common type of warning I clean up, so please don't
> forget! :) This warning is useful in other situations, and it seems
> nicer to placate GCC than to disable it.
>
> I'll sneak in another reminder: "return WTFMove()" is almost always not
> needed. Clang warns only if the move prevents return value
> optimization, but GCC will always warn if it detects the move is
> unneeded.
>

Can we add a style checker rule to detect at least simple cases?

- R. Niwa
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev