Bug 208060
| Summary: | Warning spam from ResourceLoaderOptions.h (Bots need updating to compiler without this issue) | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> |
| Component: | WebKit Misc. | Assignee: | Michael Catanzaro <mcatanzaro> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | beidson, berto, darin, dpino, erack, mcatanzaro, pnormand, ysuzuki |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | PC | ||
| OS: | Linux | ||
Michael Catanzaro
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:205:24: warning: ‘WebCore::ResourceLoaderOptions::sendLoadCallbacks’ is too small to hold all values of ‘enum class WebCore::SendCallbackPolicy’
205 | SendCallbackPolicy sendLoadCallbacks : bitWidthOfSendCallbackPolicy;
| ^~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:206:27: warning: ‘WebCore::ResourceLoaderOptions::sniffContent’ is too small to hold all values of ‘enum class WebCore::ContentSniffingPolicy’
206 | ContentSniffingPolicy sniffContent : bitWidthOfContentSniffingPolicy;
| ^~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:207:35: warning: ‘WebCore::ResourceLoaderOptions::sniffContentEncoding’ is too small to hold all values of ‘enum class WebCore::ContentEncodingSniffingPolicy’
207 | ContentEncodingSniffingPolicy sniffContentEncoding : bitWidthOfContentEncodingSniffingPolicy;
| ^~~~~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:208:25: warning: ‘WebCore::ResourceLoaderOptions::dataBufferingPolicy’ is too small to hold all values of ‘enum class WebCore::DataBufferingPolicy’
208 | DataBufferingPolicy dataBufferingPolicy : bitWidthOfDataBufferingPolicy;
| ^~~~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:209:29: warning: ‘WebCore::ResourceLoaderOptions::storedCredentialsPolicy’ is too small to hold all values of ‘enum class WebCore::StoredCredentialsPolicy’
209 | StoredCredentialsPolicy storedCredentialsPolicy : bitWidthOfStoredCredentialsPolicy;
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:210:25: warning: ‘WebCore::ResourceLoaderOptions::securityCheck’ is too small to hold all values of ‘enum class WebCore::SecurityCheckPolicy’
210 | SecurityCheckPolicy securityCheck : bitWidthOfSecurityCheckPolicy;
| ^~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:211:27: warning: ‘WebCore::ResourceLoaderOptions::certificateInfoPolicy’ is too small to hold all values of ‘enum class WebCore::CertificateInfoPolicy’
211 | CertificateInfoPolicy certificateInfoPolicy : bitWidthOfCertificateInfoPolicy;
| ^~~~~~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:212:37: warning: ‘WebCore::ResourceLoaderOptions::contentSecurityPolicyImposition’ is too small to hold all values of ‘enum class WebCore::ContentSecurityPolicyImposition’
212 | ContentSecurityPolicyImposition contentSecurityPolicyImposition : bitWidthOfContentSecurityPolicyImposition;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:213:25: warning: ‘WebCore::ResourceLoaderOptions::defersLoadingPolicy’ is too small to hold all values of ‘enum class WebCore::DefersLoadingPolicy’
213 | DefersLoadingPolicy defersLoadingPolicy : bitWidthOfDefersLoadingPolicy;
| ^~~~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:214:19: warning: ‘WebCore::ResourceLoaderOptions::cachingPolicy’ is too small to hold all values of ‘enum class WebCore::CachingPolicy’
214 | CachingPolicy cachingPolicy : bitWidthOfCachingPolicy;
| ^~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:215:27: warning: ‘WebCore::ResourceLoaderOptions::sameOriginDataURLFlag’ is too small to hold all values of ‘enum class WebCore::SameOriginDataURLFlag’
215 | SameOriginDataURLFlag sameOriginDataURLFlag : bitWidthOfSameOriginDataURLFlag;
| ^~~~~~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:216:22: warning: ‘WebCore::ResourceLoaderOptions::initiatorContext’ is too small to hold all values of ‘enum class WebCore::InitiatorContext’
216 | InitiatorContext initiatorContext : bitWidthOfInitiatorContext;
| ^~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:217:24: warning: ‘WebCore::ResourceLoaderOptions::serviceWorkersMode’ is too small to hold all values of ‘enum class WebCore::ServiceWorkersMode’
217 | ServiceWorkersMode serviceWorkersMode : bitWidthOfServiceWorkersMode;
| ^~~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:218:26: warning: ‘WebCore::ResourceLoaderOptions::applicationCacheMode’ is too small to hold all values of ‘enum class WebCore::ApplicationCacheMode’
218 | ApplicationCacheMode applicationCacheMode : bitWidthOfApplicationCacheMode;
| ^~~~~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:219:28: warning: ‘WebCore::ResourceLoaderOptions::clientCredentialPolicy’ is too small to hold all values of ‘enum class WebCore::ClientCredentialPolicy’
219 | ClientCredentialPolicy clientCredentialPolicy : bitWidthOfClientCredentialPolicy;
| ^~~~~~~~~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:220:21: warning: ‘WebCore::ResourceLoaderOptions::preflightPolicy’ is too small to hold all values of ‘enum class WebCore::PreflightPolicy’
220 | PreflightPolicy preflightPolicy : bitWidthOfPreflightPolicy;
| ^~~~~~~~~~~~~~~
/home/mcatanzaro/Projects/WebKit/Source/WebCore/loader/ResourceLoaderOptions.h:221:28: warning: ‘WebCore::ResourceLoaderOptions::loadedFromOpaqueSource’ is too small to hold all values of ‘enum class WebCore::LoadedFromOpaqueSource’
221 | LoadedFromOpaqueSource loadedFromOpaqueSource : bitWidthOfLoadedFromOpaqueSource;
| ^~~~~~~~~~~~~~~~~~~~~~
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Michael Catanzaro
Yusuke, I think we just need to roll out r256482? Or switch from using enum classes to integer constants? GCC really doesn't like this. It doesn't even have a name for this warning, so it can't be disabled afaik.
Yusuke Suzuki
(In reply to Michael Catanzaro from comment #1)
> Yusuke, I think we just need to roll out r256482? Or switch from using enum
> classes to integer constants? GCC really doesn't like this. It doesn't even
> have a name for this warning, so it can't be disabled afaik.
Can we disable this warning on GCC? Using `unsigned` looks like worse than using enum.
Michael Catanzaro
(In reply to Yusuke Suzuki from comment #2)
> Can we disable this warning on GCC? Using `unsigned` looks like worse than
> using enum.
I don't think so. Because the warning doesn't have a name (like, say, -Wsign-compare), there's no way to pass a build flag to disable it or to suppress it using a #pragma. If think if we really want to use bitfields here, then we need to change these to no longer use enums.
Eike Rathke
You might be interested in how LibreOffice handles this:
https://opengrok.libreoffice.org/xref/core/include/o3tl/typed_flags_set.hxx?r=b612cf0e
as used for example
https://opengrok.libreoffice.org/xref/core/vcl/inc/salptype.hxx?r=b4c6ac33#27
Yusuke Suzuki
(In reply to Michael Catanzaro from comment #3)
> (In reply to Yusuke Suzuki from comment #2)
> > Can we disable this warning on GCC? Using `unsigned` looks like worse than
> > using enum.
>
> I don't think so. Because the warning doesn't have a name (like, say,
> -Wsign-compare), there's no way to pass a build flag to disable it or to
> suppress it using a #pragma. If think if we really want to use bitfields
> here, then we need to change these to no longer use enums.
We really want. So unsigned is only the answer. I cannot understand why GCC is emitting such a warning without flags, clang does mot emit it :(
Darin Adler
It’s amazing that we can actually use enums with bit fields in other compilers. I’m sorry to hear that gcc is holding us back. We wanted this for years!
Michael Catanzaro
Well the warning makes sense to me. We have a clear declared width for the enum and are trying to stuff it into a field that is too small to hold it.
Maybe the warning would go away if we remove the width...? I'll try.
Michael Catanzaro
(In reply to Michael Catanzaro from comment #7)
> Maybe the warning would go away if we remove the width...? I'll try.
Nope. Was worth a try....
Michael Catanzaro
So Phil found: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414. Good job, Phil! It's fixed in GCC 8.4+, 9.3+, and 10.
I'm testing with the GCC 10.0.1 Feb 16 snapshot that we have in Fedora 32, and the warnings are indeed gone, so I'm going to close this.
Yusuke Suzuki
(In reply to Michael Catanzaro from comment #9)
> So Phil found: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414. Good job,
> Phil! It's fixed in GCC 8.4+, 9.3+, and 10.
>
> I'm testing with the GCC 10.0.1 Feb 16 snapshot that we have in Fedora 32,
> and the warnings are indeed gone, so I'm going to close this.
That sounds really nice!
Alberto Garcia
I understand that this warning is a false positive?
In other words, is the code built with the affected GCC versions safe to use?
Michael Catanzaro
I assume it's a false-positive, yes.
Brady Eidson
(In reply to Michael Catanzaro from comment #9)
> So Phil found: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414. Good job,
> Phil! It's fixed in GCC 8.4+, 9.3+, and 10.
>
> I'm testing with the GCC 10.0.1 Feb 16 snapshot that we have in Fedora 32,
> and the warnings are indeed gone, so I'm going to close this.
But.... our EWS bots are still showing the warning. Thousands of times per build.
So there's still an issue in the WebKit Open Source project.
Who's task is it to update the bots to newer GCC or clang?
Michael Catanzaro
(In reply to Brady Eidson from comment #13)
> Who's task is it to update the bots to newer GCC or clang?
Nobody responded to this?
I highly doubt the bots will be updated to a newer GCC. If avoiding warnings on the bots is desired, we'll have to suppress them by either changing WebKit's code or build system.
Darin Adler
The bots will *never* be updated? That can’t be right. When would they normally be updated if there was no GCC bug motivating us?
Separately, we should make the EWS system filter out these warnings as a stopgap measure.
Michael Catanzaro
I think they're updated for new Debian releases (every 2-3 years).
Darin Adler
Does someone know when the next Debian release is coming?
Michael Catanzaro
Guess: 1-2 more years.
Anyway, better wait for someone who actually runs the bots to respond.
Philippe Normand
The bots using the Flatpak SDK build with GCC 9.3.0. Only Adrian's EWS is left to migrate, AFAIK...