Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion All.ruleset
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Ruleset to test out github actions" Description="Currently only targetting CppCoreCheck." ToolsVersion="16.0">
<RuleSet Name="Ruleset to test out github actions" Description="Currently only targetting CppCoreCheck." ToolsVersion="17.0">
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
<Rule Id="C26400" Action="Warning" />
<Rule Id="C26401" Action="Warning" />
Expand Down Expand Up @@ -88,5 +88,6 @@
<Rule Id="C26819" Action="Warning" />
<Rule Id="C26820" Action="Warning" />
<Rule Id="C26821" Action="Warning" />
<Rule Id="C6011" Action="Warning" />
</Rules>
</RuleSet>
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ cmake_minimum_required (VERSION 3.20.5)
project(CppAnalysisExamples)

add_subdirectory(CodeQL)
add_subdirectory(CppCoreCheck)
add_subdirectory(CppCoreCheck)
add_subdirectory(CppConDemo)
12 changes: 12 additions & 0 deletions CppConDemo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.20.5)

add_library (CppCon
CppConDemo.cpp
)

set_target_properties(CppCon
PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
27 changes: 27 additions & 0 deletions CppConDemo/CppConDemo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
enum class AUTH_STATE { Nothing };

struct AUTH_CONTEXT
{
AUTH_STATE authState;
};

struct Connection
{
AUTH_CONTEXT* context_;
};

void CleanupContext(Connection* pConnection);

void InitializeContext(Connection* pConnection)
{
AUTH_CONTEXT* pContext = nullptr;
if (!pConnection)
{
CleanupContext(pConnection);
}
else
{
pContext = pConnection->context_;
}
pContext->authState = AUTH_STATE::Nothing;
}