Changeset 232599 in webkit


Ignore:
Timestamp:
Jun 7, 2018 2:05:29 PM (6 years ago)
Author:
ddkilzer@apple.com
Message:

bmalloc: Fix 'noreturn' warnings when compiling with -std=gnu++17
<https://webkit.org/b/186400>

Reviewed by Saam Barati.

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). 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.

Location:
trunk/Source/bmalloc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/bmalloc/ChangeLog

    r232269 r232599  
     12018-06-07  David Kilzer  <ddkilzer@apple.com>
     2
     3        bmalloc: Fix 'noreturn' warnings when compiling with -std=gnu++17
     4        <https://webkit.org/b/186400>
     5
     6        Reviewed by Saam Barati.
     7
     8        Fixes the following warnings when compiling with gnu++17:
     9
     10            Source/bmalloc/bmalloc/Scavenger.cpp:363:1: error: function 'threadRunLoop' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
     11            {
     12            ^
     13            Source/bmalloc/bmalloc/Scavenger.cpp:358:1: error: function 'threadEntryPoint' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
     14            {
     15            ^
     16
     17        * bmalloc/BCompiler.h:
     18        (BCOMPILER): Add support for the BCOMPILER() macro, then add
     19        BCOMPILER(GCC_OR_CLANG).  Taken from Source/WTF/wtf/Compiler.h.
     20        (BNO_RETURN): Implement 'norerturn' support using the new
     21        BCOMPILER() macros.  Taken from Source/WTF/wtf/Compiler.h.
     22        * bmalloc/Scavenger.cpp:
     23        (bmalloc::Scavenger::threadRunLoop): Remove the workaround that
     24        tricked older compilers into thinking the while() loop wasn't
     25        infinite.
     26        * bmalloc/Scavenger.h:
     27        (bmalloc::Scavenger::threadEntryPoint): Add BNO_RETURN attribute.
     28        (bmalloc::Scavenger::threadRunLoop): Ditto.
     29
    1302018-05-29  Saam Barati  <sbarati@apple.com>
    231
  • trunk/Source/bmalloc/bmalloc/BCompiler.h

    r232069 r232599  
    2626#pragma once
    2727
     28/* BCOMPILER() - the compiler being used to build the project */
     29#define BCOMPILER(BFEATURE) (defined BCOMPILER_##BFEATURE && BCOMPILER_##BFEATURE)
     30
    2831/* BCOMPILER_HAS_CLANG_FEATURE() - whether the compiler supports a particular language or library feature. */
    2932/* http://clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension */
     
    3639#define BASAN_ENABLED BCOMPILER_HAS_CLANG_FEATURE(address_sanitizer)
    3740
     41/* BCOMPILER(GCC_OR_CLANG) - GNU Compiler Collection or Clang */
     42
     43#if defined(__GNUC__)
     44#define BCOMPILER_GCC_OR_CLANG 1
     45#endif
     46
     47/* BNO_RETURN */
     48
     49#if !defined(BNO_RETURN) && BCOMPILER(GCC_OR_CLANG)
     50#define BNO_RETURN __attribute((__noreturn__))
     51#endif
     52
     53#if !defined(BNO_RETURN)
     54#define BNO_RETURN
     55#endif
     56
  • trunk/Source/bmalloc/bmalloc/Scavenger.cpp

    r232269 r232599  
    375375    // condition variable and wake us up.
    376376   
    377     auto truth = [] { return true; };
    378    
    379     while (truth()) {
     377    while (true) {
    380378        if (m_state == State::Sleep) {
    381379            std::unique_lock<Mutex> lock(m_mutex);
  • trunk/Source/bmalloc/bmalloc/Scavenger.h

    r232269 r232599  
    8383    void scheduleIfUnderMemoryPressureHoldingLock(size_t bytes);
    8484
    85     static void threadEntryPoint(Scavenger*);
    86     void threadRunLoop();
     85    BNO_RETURN static void threadEntryPoint(Scavenger*);
     86    BNO_RETURN void threadRunLoop();
    8787   
    8888    void setSelfQOSClass();
Note: See TracChangeset for help on using the changeset viewer.