<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>239290</bug_id>
          
          <creation_ts>2022-04-13 11:50:18 -0700</creation_ts>
          <short_desc>Misc compiler warnings, April 2022 edition</short_desc>
          <delta_ts>2022-04-19 10:20:20 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>mcatanzaro</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1861190</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-04-13 11:50:18 -0700</bug_when>
    <thetext>Misc compiler warnings, April 2022 edition

I&apos;m starting to get tired of -Wreturn-type....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1861214</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-04-13 12:21:03 -0700</bug_when>
    <thetext>https://github.com/WebKit/WebKit/pull/282</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1861301</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-04-13 15:56:15 -0700</bug_when>
    <thetext>Committed r292840 (249613@main): &lt;https://commits.webkit.org/249613@main&gt;

Reviewed commits have been landed. Closing PR #282 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1861302</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-04-13 15:57:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/91720326&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1862590</commentid>
    <comment_count>4</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-04-19 09:39:59 -0700</bug_when>
    <thetext>Please do not attach RELEASE_ASSERT_NOT_REACHED here. Some of them are super hot critical function, and it hurts our performance. Use 269IGNORE_RETURN_TYPE_WARNINGS_BEGIN</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1862593</commentid>
    <comment_count>5</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-04-19 09:45:31 -0700</bug_when>
    <thetext>Committed r293018 (249757@trunk): &lt;https://commits.webkit.org/249757@trunk&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1862601</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-04-19 09:59:52 -0700</bug_when>
    <thetext>ack, thanks for catching it! How scary. :(

It will happen again in the future, though, because I can&apos;t know where these areas may be, and we keep introducing more and more return type warnings. These make up probably &gt;50% of the GCC warnings that I deal with.

One option is to give up and build with -Wno-return-type, because fixing up switch statements is getting pretty old. But sadly, it does seem like a useful warning except for this pattern with switch statements, so I&apos;m a bit hesitant to do that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1862605</commentid>
    <comment_count>7</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-04-19 10:02:59 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #6)
&gt; ack, thanks for catching it! How scary. :(
&gt; 
&gt; It will happen again in the future, though, because I can&apos;t know where these
&gt; areas may be, and we keep introducing more and more return type warnings.
&gt; These make up probably &gt;50% of the GCC warnings that I deal with.
&gt; 
&gt; One option is to give up and build with -Wno-return-type, because fixing up
&gt; switch statements is getting pretty old. But sadly, it does seem like a
&gt; useful warning except for this pattern with switch statements, so I&apos;m a bit
&gt; hesitant to do that.

Can GCC have a mechanism like this? I think it can suppress most of false positives.

1. emitting this warning for normal enum case
2. not emitting this for strongly scoped enum when switch handles all scoped enums</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1862608</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-04-19 10:09:10 -0700</bug_when>
    <thetext>GCC does have many options (-Wswitch, -Wswitch-default, and -Wswitch-enum) to get exactly your preferred warnings for missing switch cases, but -Wreturn-type is orthogonal to those.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1862613</commentid>
    <comment_count>9</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-04-19 10:15:30 -0700</bug_when>
    <thetext>Did some searching... it seems C++23 has a solution for this, std::unreachable():

https://en.cppreference.com/w/cpp/utility/unreachable

In the meantime, we could add a WTF_UNREACHABLE() macro fairly easily, which could replace most use of RELEASE_ASSERT_NOT_REACHED() after switch statements that are intended to always return. Hopefully that would allow us to avoid the performance hit in these locations? Then we wouldn&apos;t have to worry about this happening again. (I know it takes you ages to track it down performance regressions....)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1862616</commentid>
    <comment_count>10</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-04-19 10:20:20 -0700</bug_when>
    <thetext>I see we already have UNREACHABLE_FOR_PLATFORM in Assertions.h, but it just calls RELEASE_ASSERT_NOT_REACHED() with a warning not to change that. &lt;_&lt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>