Bug 216280

Summary: REGRESSION(r266681) [GTK] constexpr build failure in LTS/Debian with GCC 8
Product: WebKit Reporter: Lauro Moura <lmoura>
Component: WebCore Misc.Assignee: Lauro Moura <lmoura>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bugs-noreply, darin, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=216219
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Lauro Moura 2020-09-08 12:37:01 PDT
Error:

[257/502] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/__/__/DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-54.cpp.o
FAILED: Source/WebCore/CMakeFiles/WebCore.dir/__/__/DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-54.cpp.o 
<snip long include line>
In file included from DerivedSources/ForwardingHeaders/wtf/StdLibExtras.h:32:0,
                 from DerivedSources/ForwardingHeaders/wtf/FastMalloc.h:26,
                 from ../../Source/WebCore/config.h:56,
                 from ../../Source/WebCore/platform/text/TextCodecCJK.cpp:26,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-54.cpp:1:
../../Source/WebCore/platform/text/TextCodecSingleByte.cpp: In function ‘constexpr const SingleByteDecodeTable& WebCore::tableForDecoding(WebCore::TextCodecSingleByte::Encoding)’:
DerivedSources/ForwardingHeaders/wtf/Assertions.h:587:56: error: call to non-constexpr function ‘void CRASH_WITH_INFO(...)’
 #define RELEASE_ASSERT_NOT_REACHED(...) CRASH_WITH_INFO(__VA_ARGS__)
                                         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
../../Source/WebCore/platform/text/TextCodecSingleByte.cpp:237:5: note: in expansion of macro ‘RELEASE_ASSERT_NOT_REACHED’
     RELEASE_ASSERT_NOT_REACHED();
     ^~~~~~~~~~~~~~~~~~~~~~~~~~

GCC 8 has some limitations checking non-constexpr expressions after return statements.

Example: https://godbolt.org/z/dhPvaf

Related GCC bugs: 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86678
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67371
Comment 1 Lauro Moura 2020-09-08 12:43:41 PDT
Created attachment 408256 [details]
Patch
Comment 2 Darin Adler 2020-09-08 12:52:14 PDT
Comment on attachment 408256 [details]
Patch

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

> Source/WebCore/platform/text/TextCodecSingleByte.cpp:248
> +    default:
> +        RELEASE_ASSERT_NOT_REACHED();

I guess we can do this. But sadly this has a side effect of suppressing the compile-time warning if we forget to include one of the enumeration values here. Would be nice to find a solution that does not do that.
Comment 3 Alex Christensen 2020-09-08 12:56:24 PDT
Comment on attachment 408256 [details]
Patch

I'd prefer to just remove the constexpr from this function.
Comment 4 Alex Christensen 2020-09-08 12:56:31 PDT
Comment on attachment 408256 [details]
Patch

I'd prefer to just remove the constexpr from this function.
Comment 5 Darin Adler 2020-09-08 12:58:23 PDT
Don’t we need the constexpr to make this work as a template argument?
Comment 6 Alex Christensen 2020-09-08 13:05:57 PDT
Comment on attachment 408256 [details]
Patch

No, tableForDecoding isn't used as a template argument.
Comment 7 Alex Christensen 2020-09-08 13:07:22 PDT
Created attachment 408259 [details]
Patch
Comment 8 Alex Christensen 2020-09-08 13:08:11 PDT
Created attachment 408260 [details]
Patch
Comment 9 Alex Christensen 2020-09-08 14:05:51 PDT
Lauro, does this fix your build?
Comment 10 Lauro Moura 2020-09-08 14:10:40 PDT
(In reply to Alex Christensen from comment #9)
> Lauro, does this fix your build?

Could not test it direcly on the bot but indeed it should fix.
Comment 11 Alex Christensen 2020-09-08 14:10:53 PDT
http://trac.webkit.org/r266749
Comment 12 Radar WebKit Bug Importer 2020-09-08 14:11:38 PDT
<rdar://problem/68529158>