Browse Source

开启代码静态分析,减少警告信息

tags/v2.9.7
tearshark 4 years ago
parent
commit
cdc7496613
2 changed files with 12 additions and 9 deletions
  1. 8
    7
      librf/src/state.h
  2. 4
    2
      vs_proj/librf.vcxproj

+ 8
- 7
librf/src/state.h View File

public: public:
virtual void resume() = 0; virtual void resume() = 0;
virtual bool has_handler() const = 0; virtual bool has_handler() const = 0;
virtual bool switch_scheduler_await_suspend(scheduler_t* sch, coroutine_handle<> handler) = 0;
void set_scheduler(scheduler_t* sch) void set_scheduler(scheduler_t* sch)
{ {
public: public:
virtual void resume() override; virtual void resume() override;
virtual bool has_handler() const override; virtual bool has_handler() const override;
virtual bool switch_scheduler_await_suspend(scheduler_t* sch, coroutine_handle<> handler) override;
bool switch_scheduler_await_suspend(scheduler_t* sch, coroutine_handle<> handler);
void set_initial_suspend(coroutine_handle<> handler) void set_initial_suspend(coroutine_handle<> handler)
{ {
intptr_t _id; intptr_t _id;
#endif #endif
std::exception_ptr _exception; std::exception_ptr _exception;
uint32_t _alloc_size;
uint32_t _alloc_size = 0;
std::atomic<bool> _has_value{ false }; std::atomic<bool> _has_value{ false };
bool _is_awaitor; bool _is_awaitor;
initor_type _is_initor = initor_type::None; initor_type _is_initor = initor_type::None;
virtual void destroy_deallocate() override; virtual void destroy_deallocate() override;
virtual void resume() override; virtual void resume() override;
virtual bool has_handler() const override; virtual bool has_handler() const override;
virtual bool switch_scheduler_await_suspend(scheduler_t* sch, coroutine_handle<> handler) override;
inline bool is_ready() const inline bool is_ready() const
{ {
set_exception(std::make_exception_ptr(std::move(e))); set_exception(std::make_exception_ptr(std::move(e)));
} }
template<class _PromiseT, typename = std::enable_if_t<is_promise_v<_PromiseT>>>
void future_await_suspend(coroutine_handle<_PromiseT> handler);
inline bool future_await_ready() inline bool future_await_ready()
{ {
//scoped_lock<lock_type> __guard(this->_mtx); //scoped_lock<lock_type> __guard(this->_mtx);
return _has_value.load(std::memory_order_acquire); return _has_value.load(std::memory_order_acquire);
} }
template<class _PromiseT, typename = std::enable_if_t<is_promise_v<_PromiseT>>>
void future_await_suspend(coroutine_handle<_PromiseT> handler);
bool switch_scheduler_await_suspend(scheduler_t* sch, coroutine_handle<> handler);
template<class _PromiseT, typename = std::enable_if_t<is_promise_v<_PromiseT>>> template<class _PromiseT, typename = std::enable_if_t<is_promise_v<_PromiseT>>>
void promise_initial_suspend(coroutine_handle<_PromiseT> handler); void promise_initial_suspend(coroutine_handle<_PromiseT> handler);
return static_cast<value_type*>(static_cast<void*>(_value)); return static_cast<value_type*>(static_cast<void*>(_value));
} }
alignas(value_type) unsigned char _value[sizeof(value_type)];
alignas(value_type) unsigned char _value[sizeof(value_type)] = {0};
}; };
template<> template<>

+ 4
- 2
vs_proj/librf.vcxproj View File

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>ClangCL</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableClangTidyCodeAnalysis>true</EnableClangTidyCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<CLanguageStandard>c11</CLanguageStandard> <CLanguageStandard>c11</CLanguageStandard>
<CppLanguageStandard>c++1y</CppLanguageStandard> <CppLanguageStandard>c++1y</CppLanguageStandard>
<DisableSpecificWarnings>4834</DisableSpecificWarnings> <DisableSpecificWarnings>4834</DisableSpecificWarnings>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>

Loading…
Cancel
Save