diff --git a/All.ruleset b/All.ruleset index 4490319..5bba13e 100644 --- a/All.ruleset +++ b/All.ruleset @@ -1,5 +1,5 @@  - + @@ -88,5 +88,6 @@ + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fd609c..aa77d0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,4 +2,5 @@ cmake_minimum_required (VERSION 3.20.5) project(CppAnalysisExamples) add_subdirectory(CodeQL) -add_subdirectory(CppCoreCheck) \ No newline at end of file +add_subdirectory(CppCoreCheck) +add_subdirectory(CppConDemo) \ No newline at end of file diff --git a/CppConDemo/CMakeLists.txt b/CppConDemo/CMakeLists.txt new file mode 100644 index 0000000..73d4d03 --- /dev/null +++ b/CppConDemo/CMakeLists.txt @@ -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 +) \ No newline at end of file diff --git a/CppConDemo/CppConDemo.cpp b/CppConDemo/CppConDemo.cpp new file mode 100644 index 0000000..5f65901 --- /dev/null +++ b/CppConDemo/CppConDemo.cpp @@ -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; +}