WebKit Bugzilla
Attachment 342185 Details for
Bug 186400
: bmalloc: Fix 'noreturn' warnings when compiling with -std=gnu++17
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch v2
bug-186400-20180607103615.patch (text/plain), 4.23 KB, created by
David Kilzer (:ddkilzer)
on 2018-06-07 10:36:16 PDT
(
hide
)
Description:
Patch v2
Filename:
MIME Type:
Creator:
David Kilzer (:ddkilzer)
Created:
2018-06-07 10:36:16 PDT
Size:
4.23 KB
patch
obsolete
>Subversion Revision: 232581 >diff --git a/Source/bmalloc/ChangeLog b/Source/bmalloc/ChangeLog >index 2e9c829be29bbb19a22d33be55dc867c0b5bbf8c..a4c9cf249684e02bb07cd06ba3b2e49b5b706a6b 100644 >--- a/Source/bmalloc/ChangeLog >+++ b/Source/bmalloc/ChangeLog >@@ -1,3 +1,33 @@ >+2018-06-07 David Kilzer <ddkilzer@apple.com> >+ >+ bmalloc: Fix 'noreturn' warnings when compiling with -std=gnu++17 >+ <https://webkit.org/b/186400> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fixes the following warnings when compiling with gnu++17: >+ >+ Source/bmalloc/bmalloc/Scavenger.cpp:363:1: error: function 'threadRunLoop' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn] >+ { >+ ^ >+ Source/bmalloc/bmalloc/Scavenger.cpp:358:1: error: function 'threadEntryPoint' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn] >+ { >+ ^ >+ >+ * bmalloc/BCompiler.h: >+ (BCOMPILER): Add support for the BCOMPILER() macro, then add >+ BCOMPILER(GCC_OR_CLANG) and BCOMPILER(MSVC). Taken from >+ Source/WTF/wtf/Compiler.h. >+ (BNO_RETURN): Implement 'norerturn' support using the new >+ BCOMPILER() macros. Taken from Source/WTF/wtf/Compiler.h. >+ * bmalloc/Scavenger.cpp: >+ (bmalloc::Scavenger::threadRunLoop): Remove the workaround that >+ tricked older compilers into thinking the while() loop wasn't >+ infinite. >+ * bmalloc/Scavenger.h: >+ (bmalloc::Scavenger::threadEntryPoint): Add BNO_RETURN attribute. >+ (bmalloc::Scavenger::threadRunLoop): Ditto. >+ > 2018-05-29 Saam Barati <sbarati@apple.com> > > JSC should put bmalloc's scavenger into mini mode >diff --git a/Source/bmalloc/bmalloc/BCompiler.h b/Source/bmalloc/bmalloc/BCompiler.h >index 1a927d8440cdce8006c876e517b4b0d02ad6dd59..e4f6786f0c82084f282b6a8d985a1107021e3fe5 100644 >--- a/Source/bmalloc/bmalloc/BCompiler.h >+++ b/Source/bmalloc/bmalloc/BCompiler.h >@@ -25,6 +25,9 @@ > > #pragma once > >+/* BCOMPILER() - the compiler being used to build the project */ >+#define BCOMPILER(BFEATURE) (defined BCOMPILER_##BFEATURE && BCOMPILER_##BFEATURE) >+ > /* BCOMPILER_HAS_CLANG_FEATURE() - whether the compiler supports a particular language or library feature. */ > /* http://clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension */ > #ifdef __has_feature >@@ -35,3 +38,29 @@ > > #define BASAN_ENABLED BCOMPILER_HAS_CLANG_FEATURE(address_sanitizer) > >+/* BCOMPILER(GCC_OR_CLANG) - GNU Compiler Collection or Clang */ >+ >+#if defined(__GNUC__) >+#define BCOMPILER_GCC_OR_CLANG 1 >+#endif >+ >+/* BCOMPILER(MSVC) - Microsoft Visual C++ */ >+ >+#if defined(_MSC_VER) >+#define BCOMPILER_MSVC 1 >+#endif >+ >+/* BNO_RETURN */ >+ >+#if !defined(BNO_RETURN) && BCOMPILER(GCC_OR_CLANG) >+#define BNO_RETURN __attribute((__noreturn__)) >+#endif >+ >+#if !defined(BNO_RETURN) && BCOMPILER(MSVC) >+#define BNO_RETURN __declspec(noreturn) >+#endif >+ >+#if !defined(BNO_RETURN) >+#define BNO_RETURN >+#endif >+ >diff --git a/Source/bmalloc/bmalloc/Scavenger.cpp b/Source/bmalloc/bmalloc/Scavenger.cpp >index 724c3f72166b76bc892e3bc59e0207ee944f0f41..de99c176bc9cc89453d354e2804b5b794a89cf67 100644 >--- a/Source/bmalloc/bmalloc/Scavenger.cpp >+++ b/Source/bmalloc/bmalloc/Scavenger.cpp >@@ -374,9 +374,7 @@ void Scavenger::threadRunLoop() > // We require any state change while we are sleeping to signal to our > // condition variable and wake us up. > >- auto truth = [] { return true; }; >- >- while (truth()) { >+ while (true) { > if (m_state == State::Sleep) { > std::unique_lock<Mutex> lock(m_mutex); > m_condition.wait(lock, [&]() { return m_state != State::Sleep; }); >diff --git a/Source/bmalloc/bmalloc/Scavenger.h b/Source/bmalloc/bmalloc/Scavenger.h >index 919f6e9db9f0a9df75fca9fa462e5bdd5245a273..849d4d9218ee6e1f1d14523100b00311cc77d433 100644 >--- a/Source/bmalloc/bmalloc/Scavenger.h >+++ b/Source/bmalloc/bmalloc/Scavenger.h >@@ -82,8 +82,8 @@ private: > > void scheduleIfUnderMemoryPressureHoldingLock(size_t bytes); > >- static void threadEntryPoint(Scavenger*); >- void threadRunLoop(); >+ BNO_RETURN static void threadEntryPoint(Scavenger*); >+ BNO_RETURN void threadRunLoop(); > > void setSelfQOSClass(); > void setThreadName(const char*);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186400
:
342184
|
342185
|
342199