diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 78ae446fbb5e..bbec77e437f2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,6 +42,14 @@ jobs: # queries: ./path/to/local/query, your-org/your-repo/queries@main # Learn more about CodeQL language support at https://git.io/codeql-language-support + - name: Install Clang-16 + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh 16 + sudo ln -s -f `which clang-16` `which clang` + sudo ln -s -f `which clang++-16` `which clang++` + - name: Build dd-trace-dotnet run: | ./tracer/build.sh BuildProfilerHome BuildNativeLoader @@ -111,6 +119,14 @@ jobs: # queries: ./path/to/local/query, your-org/your-repo/queries@main # Learn more about CodeQL language support at https://git.io/codeql-language-support + - name: Install Clang-16 + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh 16 + sudo ln -s -f `which clang-16` `which clang` + sudo ln -s -f `which clang++-16` `which clang++` + - name: Build dd-trace-dotnet run: | ./tracer/build.sh BuildTracerHome diff --git a/build/cmake/FindCoreclr.cmake b/build/cmake/FindCoreclr.cmake index 8f29604e7b63..c2c71bb9bde2 100644 --- a/build/cmake/FindCoreclr.cmake +++ b/build/cmake/FindCoreclr.cmake @@ -10,7 +10,7 @@ target_include_directories(coreclr PUBLIC ) target_compile_options(coreclr PUBLIC - -std=c++17 + -std=c++20 -DPAL_STDCPP_COMPAT -DPLATFORM_UNIX -DUNICODE diff --git a/build/cmake/FindGoogleTest.cmake b/build/cmake/FindGoogleTest.cmake index cfdaa20d290e..fe3fb7fcca34 100644 --- a/build/cmake/FindGoogleTest.cmake +++ b/build/cmake/FindGoogleTest.cmake @@ -1,12 +1,12 @@ # GoogleTest requires at least C++11 -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) include(FetchContent) FetchContent_Declare( googletest - URL https://github.com/google/googletest/archive/15460959cbbfa20e66ef0b5ab497367e47fc0a04.zip + URL https://github.com/google/googletest/archive/f8d7d77c06936315286eb55f8de22cd23c188571.zip ) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) diff --git a/build/cmake/FindPPDB.cmake b/build/cmake/FindPPDB.cmake index ea8dbe4dcdd7..d5ee86d89cca 100644 --- a/build/cmake/FindPPDB.cmake +++ b/build/cmake/FindPPDB.cmake @@ -1,6 +1,6 @@ # Sets compiler options -add_compile_options(-std=c++17 -fPIC -fms-extensions -g) +add_compile_options(-std=c++20 -fPIC -fms-extensions -g) add_compile_options(-DPAL_STDCPP_COMPAT -DPLATFORM_UNIX -DUNICODE) add_compile_options(-Wno-invalid-noreturn -Wno-macro-redefined) diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Linux/CMakeLists.txt b/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Linux/CMakeLists.txt index 7a03b3de51bb..bc9f9eed413a 100644 --- a/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Linux/CMakeLists.txt +++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Linux/CMakeLists.txt @@ -15,7 +15,7 @@ message(STATUS "Run Clang Undefined-Behavior Sanitizer: " ${RUN_UBSAN}) # ****************************************************** # Sets compiler options -add_compile_options(-std=c++17 -fPIC -fms-extensions -g) +add_compile_options(-std=c++20 -fPIC -fms-extensions -g) add_compile_options(-DPAL_STDCPP_COMPAT -DPLATFORM_UNIX -DUNICODE) add_compile_options(-Wno-invalid-noreturn -Wno-macro-redefined) diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Windows/Datadog.Profiler.Native.Windows.vcxproj b/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Windows/Datadog.Profiler.Native.Windows.vcxproj index b2a64c66b9bb..25433bbd5273 100644 --- a/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Windows/Datadog.Profiler.Native.Windows.vcxproj +++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Windows/Datadog.Profiler.Native.Windows.vcxproj @@ -103,7 +103,7 @@ true NotUsing pch.h - stdcpp17 + stdcpp20 MultiThreadedDebug ../Datadog.Profiler.Native;$(DOTNET-TRACER-REPO-ROOT-PATH);$(CORECLR-PATH)/pal/prebuilt/inc;$(CORECLR-PATH)/inc;$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) $(ENABLE_MULTIPROCESSOR_COMPILATION) @@ -133,7 +133,7 @@ true NotUsing pch.h - stdcpp17 + stdcpp20 MultiThreaded ../Datadog.Profiler.Native;$(DOTNET-TRACER-REPO-ROOT-PATH);$(CORECLR-PATH)/pal/prebuilt/inc;$(CORECLR-PATH)/inc;$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) $(ENABLE_MULTIPROCESSOR_COMPILATION) @@ -163,7 +163,7 @@ true NotUsing pch.h - stdcpp17 + stdcpp20 MultiThreadedDebug ../Datadog.Profiler.Native;$(DOTNET-TRACER-REPO-ROOT-PATH);$(CORECLR-PATH)/pal/prebuilt/inc;$(CORECLR-PATH)/inc;$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) $(ENABLE_MULTIPROCESSOR_COMPILATION) @@ -193,7 +193,7 @@ true NotUsing pch.h - stdcpp17 + stdcpp20 MultiThreaded diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Native/Datadog.Profiler.Native.vcxproj b/profiler/src/ProfilerEngine/Datadog.Profiler.Native/Datadog.Profiler.Native.vcxproj index 2a9abfd111bf..4e7063e0260f 100644 --- a/profiler/src/ProfilerEngine/Datadog.Profiler.Native/Datadog.Profiler.Native.vcxproj +++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Native/Datadog.Profiler.Native.vcxproj @@ -115,7 +115,7 @@ true NotUsing pch.h - stdcpp17 + stdcpp20 MultiThreadedDebug $(DOTNET-TRACER-REPO-ROOT-PATH);$(CORECLR-PATH)/pal/prebuilt/inc;$(CORECLR-PATH)/inc;$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) $(ENABLE_MULTIPROCESSOR_COMPILATION) @@ -146,7 +146,7 @@ true NotUsing pch.h - stdcpp17 + stdcpp20 MultiThreaded $(DOTNET-TRACER-REPO-ROOT-PATH);$(CORECLR-PATH)/pal/prebuilt/inc;$(CORECLR-PATH)/inc;$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) $(ENABLE_MULTIPROCESSOR_COMPILATION) @@ -177,7 +177,7 @@ true NotUsing pch.h - stdcpp17 + stdcpp20 MultiThreadedDebug $(DOTNET-TRACER-REPO-ROOT-PATH);$(CORECLR-PATH)/pal/prebuilt/inc;$(CORECLR-PATH)/inc;$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) $(ENABLE_MULTIPROCESSOR_COMPILATION) @@ -208,7 +208,7 @@ true NotUsing pch.h - stdcpp17 + stdcpp20 MultiThreaded diff --git a/profiler/test/Datadog.Linux.ApiWrapper.Tests/CMakeLists.txt b/profiler/test/Datadog.Linux.ApiWrapper.Tests/CMakeLists.txt index d72526c7dfed..3ec25328f352 100644 --- a/profiler/test/Datadog.Linux.ApiWrapper.Tests/CMakeLists.txt +++ b/profiler/test/Datadog.Linux.ApiWrapper.Tests/CMakeLists.txt @@ -4,10 +4,10 @@ include(GoogleTest) # ****************************************************** # Compiler options # ****************************************************** -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) # Sets compiler options -add_compile_options(-Wc++17-extensions) +add_compile_options(-Wc++20-extensions) if (DEFINED ENV{IsAlpine} AND "$ENV{IsAlpine}" MATCHES "true") add_compile_options(-DDD_ALPINE) @@ -60,7 +60,7 @@ target_link_libraries(${TEST_EXECUTABLE_NAME} -static-libgcc -static-libstdc++ -ldl - -Wc++17-extensions + -Wc++20-extensions ) gtest_discover_tests(${TEST_EXECUTABLE_NAME}) diff --git a/profiler/test/Datadog.Profiler.Native.Tests/CMakeLists.txt b/profiler/test/Datadog.Profiler.Native.Tests/CMakeLists.txt index 09a9f75c4cb2..d6c2c4e002db 100644 --- a/profiler/test/Datadog.Profiler.Native.Tests/CMakeLists.txt +++ b/profiler/test/Datadog.Profiler.Native.Tests/CMakeLists.txt @@ -4,12 +4,16 @@ include(GoogleTest) # ****************************************************** # Compiler options # ****************************************************** -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) # Sets compiler options add_compile_options(-fPIC -fms-extensions) add_compile_options(-DPAL_STDCPP_COMPAT -DPLATFORM_UNIX -DUNICODE) -add_compile_options(-Wno-invalid-noreturn -Wno-macro-redefined -Wc++17-extensions -DDD_TEST) +add_compile_options(-Wno-invalid-noreturn -Wno-macro-redefined -Wc++20-extensions -DDD_TEST) + +if (IS_ALPINE) + add_compile_options(-DDD_ALPINE) +endif() if (RUN_ASAN) add_compile_options(-g -fsanitize=address -fno-omit-frame-pointer) @@ -76,7 +80,7 @@ target_link_libraries(${TEST_EXECUTABLE_NAME} -static-libgcc -static-libstdc++ -lstdc++fs - -Wc++17-extensions + -Wc++20-extensions ) gtest_discover_tests(${TEST_EXECUTABLE_NAME}) diff --git a/profiler/test/Datadog.Profiler.Native.Tests/Datadog.Profiler.Native.Tests.vcxproj b/profiler/test/Datadog.Profiler.Native.Tests/Datadog.Profiler.Native.Tests.vcxproj index 0bf30bf2ecc0..ba922523116e 100644 --- a/profiler/test/Datadog.Profiler.Native.Tests/Datadog.Profiler.Native.Tests.vcxproj +++ b/profiler/test/Datadog.Profiler.Native.Tests/Datadog.Profiler.Native.Tests.vcxproj @@ -107,7 +107,7 @@ EnableFastChecks MultiThreadedDebug Level3 - stdcpp17 + stdcpp20 ..\..\src\ProfilerEngine\Datadog.Profiler.Native;$(DOTNET-TRACER-REPO-ROOT-PATH);$(CORECLR-PATH)/pal/prebuilt/inc;$(CORECLR-PATH)/inc;$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) $(ENABLE_MULTIPROCESSOR_COMPILATION) true @@ -130,7 +130,7 @@ EnableFastChecks MultiThreadedDebug Level3 - stdcpp17 + stdcpp20 ..\..\src\ProfilerEngine\Datadog.Profiler.Native;$(DOTNET-TRACER-REPO-ROOT-PATH);$(CORECLR-PATH)/pal/prebuilt/inc;$(CORECLR-PATH)/inc;$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) $(ENABLE_MULTIPROCESSOR_COMPILATION) true @@ -151,7 +151,7 @@ MultiThreaded Level3 ProgramDatabase - stdcpp17 + stdcpp20 ..\..\src\ProfilerEngine\Datadog.Profiler.Native;$(DOTNET-TRACER-REPO-ROOT-PATH);$(CORECLR-PATH)/pal/prebuilt/inc;$(CORECLR-PATH)/inc;$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) $(ENABLE_MULTIPROCESSOR_COMPILATION) true @@ -174,7 +174,7 @@ MultiThreaded Level3 ProgramDatabase - stdcpp17 + stdcpp20 ..\..\src\ProfilerEngine\Datadog.Profiler.Native;$(DOTNET-TRACER-REPO-ROOT-PATH);$(CORECLR-PATH)/pal/prebuilt/inc;$(CORECLR-PATH)/inc;$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) $(ENABLE_MULTIPROCESSOR_COMPILATION) true diff --git a/shared/src/Datadog.Trace.ClrProfiler.Native/CMakeLists.txt b/shared/src/Datadog.Trace.ClrProfiler.Native/CMakeLists.txt index 09ea38e8cd2c..a977ce2986c7 100644 --- a/shared/src/Datadog.Trace.ClrProfiler.Native/CMakeLists.txt +++ b/shared/src/Datadog.Trace.ClrProfiler.Native/CMakeLists.txt @@ -102,7 +102,7 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BIN_DIR}) # ****************************************************** # Sets compiler options -add_compile_options(-std=c++17 -fPIC -fms-extensions -fvisibility=hidden -g) +add_compile_options(-std=c++20 -fPIC -fms-extensions -fvisibility=hidden -g) add_compile_options(-DPAL_STDCPP_COMPAT -DPLATFORM_UNIX -DUNICODE) add_compile_options(-Wno-invalid-noreturn -Wno-macro-redefined) if (ISMACOS) diff --git a/shared/src/Datadog.Trace.ClrProfiler.Native/Datadog.Trace.ClrProfiler.Native.vcxproj b/shared/src/Datadog.Trace.ClrProfiler.Native/Datadog.Trace.ClrProfiler.Native.vcxproj index ca9f13bf35ec..5b281cc6a213 100644 --- a/shared/src/Datadog.Trace.ClrProfiler.Native/Datadog.Trace.ClrProfiler.Native.vcxproj +++ b/shared/src/Datadog.Trace.ClrProfiler.Native/Datadog.Trace.ClrProfiler.Native.vcxproj @@ -161,7 +161,7 @@ WIN32;X86;BIT86;_DEBUG;DATADOGNATIVELOADER_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;%(PreprocessorDefinitions) true MultiThreadedDebug - stdcpp17 + stdcpp20 $(LIB_INCLUDES);$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) /FS %(AdditionalOptions) $(ENABLE_MULTIPROCESSOR_COMPILATION) @@ -189,7 +189,7 @@ true WIN32;X86;BIT86;NDEBUG;DATADOGNATIVELOADER_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;%(PreprocessorDefinitions) true - stdcpp17 + stdcpp20 NotUsing $(LIB_INCLUDES);$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) /FS %(AdditionalOptions) @@ -213,7 +213,7 @@ MultiThreadedDebug false true - stdcpp17 + stdcpp20 true BIT64;AMD64;_DEBUG;DATADOGNATIVELOADER_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;%(PreprocessorDefinitions) $(SHARED-LIB-INCLUDES);$(LIB_INCLUDES);%(AdditionalIncludeDirectories) @@ -240,7 +240,7 @@ Speed true true - stdcpp17 + stdcpp20 $(ENABLE_MULTIPROCESSOR_COMPILATION) true $(LIB_INCLUDES);$(SHARED-LIB-INCLUDES);%(AdditionalIncludeDirectories) @@ -368,4 +368,4 @@ - + \ No newline at end of file diff --git a/shared/src/native-lib/PPDB/PPDB.vcxproj b/shared/src/native-lib/PPDB/PPDB.vcxproj index fc9397f94815..3171f6f4d87e 100644 --- a/shared/src/native-lib/PPDB/PPDB.vcxproj +++ b/shared/src/native-lib/PPDB/PPDB.vcxproj @@ -79,7 +79,7 @@ NotUsing pch.h $(MSBuildProjectDirectory)\inc - stdcpp17 + stdcpp20 MultiThreadedDebug @@ -99,7 +99,7 @@ NotUsing pch.h $(MSBuildProjectDirectory)\inc - stdcpp17 + stdcpp20 MultiThreaded @@ -119,7 +119,7 @@ NotUsing pch.h $(MSBuildProjectDirectory)\inc - stdcpp17 + stdcpp20 MultiThreadedDebug @@ -139,7 +139,7 @@ NotUsing pch.h $(MSBuildProjectDirectory)\inc - stdcpp17 + stdcpp20 MultiThreaded diff --git a/shared/src/native-lib/coreclr/src/README.md b/shared/src/native-lib/coreclr/src/README.md index 7a98f5cf78c5..b6f9b0177db6 100644 --- a/shared/src/native-lib/coreclr/src/README.md +++ b/shared/src/native-lib/coreclr/src/README.md @@ -26,3 +26,5 @@ in `pal.h`, add the definition of g_arm64_atomics_present after Processor-specif // the machine extern bool g_arm64_atomics_present; #endif + +in `shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings.h` (l.317) commented `#define __bound` to fix linux compilation diff --git a/shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings.h index 21a40d91a0dd..1011fe470ed3 100644 --- a/shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings.h +++ b/shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings.h @@ -314,7 +314,7 @@ __ANNOTATION(SAL_failureDefault(enum __SAL_failureKind)); #define __deallocate(kind) _Pre_ __notnull __post_invalid #define __deallocate_opt(kind) _Pre_ __maybenull __post_invalid #endif -#define __bound __inner_bound +//#define __bound __inner_bound #define __range(lb,ub) __inner_range(lb,ub) #define __in_bound _Pre_ __inner_bound #define __out_bound _Post_ __inner_bound diff --git a/shared/src/native-src/logger.h b/shared/src/native-src/logger.h index b0dea1ac04c7..95f43806502e 100644 --- a/shared/src/native-src/logger.h +++ b/shared/src/native-src/logger.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -152,6 +153,7 @@ std::string Logger::GetLogPath(const std::string& file_name_suffix) return log_path.string(); } +#ifdef MACOS template void WriteToStream(std::ostringstream& oss, T const& x) { @@ -164,6 +166,70 @@ void WriteToStream(std::ostringstream& oss, T const& x) oss << x; } } +#else + +// On Debian buster, we only have libstdc++ 8 which does not have a definition for the std::same_as concept +// and std::remove_cvref_t struct. +// In that case, when running on Windows or using a libstdc++ >= 10, we just alias the std::same_as and std::remove_cvref_t symbols, +// Otherwise, we just implement them. +#if defined(_WINDOWS) || (defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 10 ) + +template +concept same_as = std::same_as; + +template +using remove_cvref_t = typename std::remove_cvref_t; + +#else + +template +struct remove_cvref +{ + typedef std::remove_cv_t> type; +}; + +template< class T > +using remove_cvref_t = typename remove_cvref::type; + +namespace detail +{ + template< class T, class U > + concept SameHelper = std::is_same_v; +} + +template< class T, class U > +concept same_as = detail::SameHelper && detail::SameHelper; + +#endif + +template +concept IsWstring = same_as || + // check if it's WCHAR[N] or WCHAR* + same_as>>, WCHAR>; + +template +void WriteToStream(std::ostringstream& oss, T const& x) +{ + if constexpr (std::is_same_v) + { + oss << ::shared::ToString(x); + } + else if constexpr (std::is_array_v) + { + oss << ::shared::ToString(x, std::extent_v); + } + else + { + oss << ::shared::ToString(x); + } +} + +template +void WriteToStream(std::ostringstream& oss, T const& x) +{ + oss << x; +} +#endif template static std::string LogToString(Args const&... args) diff --git a/shared/src/native-src/string.cpp b/shared/src/native-src/string.cpp index 32c9ceff1c2e..3c23aed177c9 100644 --- a/shared/src/native-src/string.cpp +++ b/shared/src/native-src/string.cpp @@ -21,6 +21,12 @@ namespace shared { std::string ToString(const WSTRING& wstr) { return ToString(wstr.data(), wstr.size()); } + std::string ToString(const WCHAR* wstr) + { + if (wstr == nullptr || *wstr == WStr('\0')) return std::string(); + return ToString(wstr, WStrLen(wstr)); + } + std::string ToString(const WCHAR* wstr, std::size_t nbChars) { #ifdef _WIN32 diff --git a/shared/src/native-src/string.h b/shared/src/native-src/string.h index ad88a7fccbe6..e9bdc611f81c 100644 --- a/shared/src/native-src/string.h +++ b/shared/src/native-src/string.h @@ -47,6 +47,7 @@ std::string ToString(const std::string& str); std::string ToString(const char* str); std::string ToString(uint64_t i); std::string ToString(const WSTRING& wstr); +std::string ToString(const WCHAR* wstr); std::string ToString(const WCHAR* wstr, std::size_t nbChars); std::string ToString(const GUID& uid); diff --git a/shared/test/Datadog.Trace.ClrProfiler.Native.Tests/CMakeLists.txt b/shared/test/Datadog.Trace.ClrProfiler.Native.Tests/CMakeLists.txt index 3100e6c1bb9c..ae674effbb58 100644 --- a/shared/test/Datadog.Trace.ClrProfiler.Native.Tests/CMakeLists.txt +++ b/shared/test/Datadog.Trace.ClrProfiler.Native.Tests/CMakeLists.txt @@ -2,12 +2,12 @@ include(GoogleTest) # ****************************************************** # Compiler options # ****************************************************** -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) # Sets compiler options -add_compile_options(-std=c++17 -fms-extensions) +add_compile_options(-std=c++20 -fms-extensions) add_compile_options(-DPAL_STDCPP_COMPAT -DPLATFORM_UNIX -DUNICODE) -add_compile_options(-Wno-invalid-noreturn -Wno-macro-redefined -Wc++17-extensions) +add_compile_options(-Wno-invalid-noreturn -Wno-macro-redefined -Wc++20-extensions) if(ISLINUX) add_compile_options(-stdlib=libstdc++ -DLINUX -Wno-pragmas) @@ -62,7 +62,7 @@ target_link_libraries(${TEST_EXECUTABLE_NAME} -static-libgcc -static-libstdc++ -lstdc++fs - -Wc++17-extensions + -Wc++20-extensions ) gtest_discover_tests(${TEST_EXECUTABLE_NAME}) diff --git a/shared/test/Datadog.Trace.ClrProfiler.Native.Tests/Datadog.Trace.ClrProfiler.Native.Tests.vcxproj b/shared/test/Datadog.Trace.ClrProfiler.Native.Tests/Datadog.Trace.ClrProfiler.Native.Tests.vcxproj index fe15c6bdebd9..0e1aaf0b5dd9 100644 --- a/shared/test/Datadog.Trace.ClrProfiler.Native.Tests/Datadog.Trace.ClrProfiler.Native.Tests.vcxproj +++ b/shared/test/Datadog.Trace.ClrProfiler.Native.Tests/Datadog.Trace.ClrProfiler.Native.Tests.vcxproj @@ -148,7 +148,7 @@ WIN32;X86;BIT86;_DEBUG;DATADOGNATIVELOADER_EXPORTS;_WINDOWS;_USRDLL;_CONSOLE;%(PreprocessorDefinitions) true MultiThreadedDebug - stdcpp17 + stdcpp20 $(LIB_INCLUDES);%(AdditionalIncludeDirectories) @@ -165,7 +165,7 @@ true WIN32;X86;BIT86;NDEBUG;DATADOGNATIVELOADER_EXPORTS;_WINDOWS;_USRDLL;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpp20 MultiThreaded $(LIB_INCLUDES);%(AdditionalIncludeDirectories) @@ -183,7 +183,7 @@ true BIT64;AMD64;_DEBUG;DATADOGNATIVELOADER_EXPORTS;_WINDOWS;_USRDLL;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpp20 MultiThreadedDebug $(LIB_INCLUDES);%(AdditionalIncludeDirectories) @@ -201,7 +201,7 @@ true BIT64;AMD64;NDEBUG;DATADOGNATIVELOADER_EXPORTS;_WINDOWS;_USRDLL;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpp20 MultiThreaded $(LIB_INCLUDES);%(AdditionalIncludeDirectories) @@ -219,7 +219,7 @@ true BIT64;ARM64;_DEBUG;DATADOGNATIVELOADER_EXPORTS;_WINDOWS;_USRDLL;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpp20 MultiThreadedDebug $(LIB_INCLUDES);%(AdditionalIncludeDirectories) @@ -237,7 +237,7 @@ true BIT64;ARM64;NDEBUG;DATADOGNATIVELOADER_EXPORTS;_WINDOWS;_USRDLL;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpp20 MultiThreaded $(LIB_INCLUDES);%(AdditionalIncludeDirectories) diff --git a/tracer/build/_build/Build.Profiler.Steps.cs b/tracer/build/_build/Build.Profiler.Steps.cs index 278f659e64d1..3286939e3ed4 100644 --- a/tracer/build/_build/Build.Profiler.Steps.cs +++ b/tracer/build/_build/Build.Profiler.Steps.cs @@ -292,7 +292,7 @@ private async Task BuildAndRunProfilerIntegrationTestsInternal(string filter) .SetTargets("BuildCpp") .AddProperty("RunCodeAnalysis", "true") .AddProperty("EnableClangTidyCodeAnalysis", "true") - .AddProperty("ClangTidyChecks", $"\"{ClangTidyChecks}\"") + .AddProperty("ClangTidyChecks", $"\"{ClangTidyChecks}\" --list-checks") .CombineWith(platforms, (m, platform) => m .SetTargetPlatform(platform) .SetLoggers($"FileLogger,Microsoft.Build;logfile={ProfilerBuildDataDirectory / $"windows-profiler-clang-tidy-{platform}.txt"}"))); diff --git a/tracer/src/Datadog.Tracer.Native/CMakeLists.txt b/tracer/src/Datadog.Tracer.Native/CMakeLists.txt index e7e0a3571cdb..d61747385ffa 100644 --- a/tracer/src/Datadog.Tracer.Native/CMakeLists.txt +++ b/tracer/src/Datadog.Tracer.Native/CMakeLists.txt @@ -108,7 +108,7 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BIN_DIR}) # ****************************************************** # Sets compiler options -add_compile_options(-std=c++17 -fPIC -fms-extensions -fvisibility=hidden -g) +add_compile_options(-std=c++20 -fPIC -fms-extensions -fvisibility=hidden -g) add_compile_options(-DPAL_STDCPP_COMPAT -DPLATFORM_UNIX -DUNICODE) add_compile_options(-Wno-invalid-noreturn -Wno-macro-redefined) if (ISMACOS) diff --git a/tracer/src/Datadog.Tracer.Native/Datadog.Tracer.Native.DLL.vcxproj b/tracer/src/Datadog.Tracer.Native/Datadog.Tracer.Native.DLL.vcxproj index 3e6960e3e06e..14e8acfe4829 100644 --- a/tracer/src/Datadog.Tracer.Native/Datadog.Tracer.Native.DLL.vcxproj +++ b/tracer/src/Datadog.Tracer.Native/Datadog.Tracer.Native.DLL.vcxproj @@ -147,7 +147,7 @@ true MultiThreadedDebug true - stdcpp17 + stdcpp20 $(ENABLE_MULTIPROCESSOR_COMPILATION) true $(LIB_INCLUDES);%(AdditionalIncludeDirectories) @@ -175,7 +175,7 @@ Speed true true - stdcpp17 + stdcpp20 $(ENABLE_MULTIPROCESSOR_COMPILATION) true $(LIB_INCLUDES);%(AdditionalIncludeDirectories) @@ -201,7 +201,7 @@ MultiThreadedDebug false true - stdcpp17 + stdcpp20 true $(ENABLE_MULTIPROCESSOR_COMPILATION) true @@ -232,7 +232,7 @@ Speed true true - stdcpp17 + stdcpp20 $(ENABLE_MULTIPROCESSOR_COMPILATION) true $(LIB_INCLUDES);%(AdditionalIncludeDirectories) @@ -258,7 +258,7 @@ MultiThreadedDebug false true - stdcpp17 + stdcpp20 true $(ENABLE_MULTIPROCESSOR_COMPILATION) true @@ -289,7 +289,7 @@ Speed true true - stdcpp17 + stdcpp20 $(ENABLE_MULTIPROCESSOR_COMPILATION) true $(LIB_INCLUDES);%(AdditionalIncludeDirectories) diff --git a/tracer/src/Datadog.Tracer.Native/Datadog.Tracer.Native.vcxproj b/tracer/src/Datadog.Tracer.Native/Datadog.Tracer.Native.vcxproj index 362cacb0487c..721f8682b041 100644 --- a/tracer/src/Datadog.Tracer.Native/Datadog.Tracer.Native.vcxproj +++ b/tracer/src/Datadog.Tracer.Native/Datadog.Tracer.Native.vcxproj @@ -122,7 +122,7 @@ Level3 Disabled MultiThreadedDebug - stdcpp17 + stdcpp20 true true $(ENABLE_MULTIPROCESSOR_COMPILATION) @@ -144,7 +144,7 @@ Level3 MaxSpeed MultiThreaded - stdcpp17 + stdcpp20 AnySuitable true Speed @@ -171,7 +171,7 @@ Level3 Disabled MultiThreadedDebug - stdcpp17 + stdcpp20 false true true @@ -195,7 +195,7 @@ Level3 MaxSpeed MultiThreaded - stdcpp17 + stdcpp20 AnySuitable true Speed @@ -222,7 +222,7 @@ Level3 Disabled MultiThreadedDebug - stdcpp17 + stdcpp20 false true true @@ -246,7 +246,7 @@ Level3 MaxSpeed MultiThreaded - stdcpp17 + stdcpp20 AnySuitable true Speed diff --git a/tracer/src/Datadog.Tracer.Native/debugger_method_rewriter.cpp b/tracer/src/Datadog.Tracer.Native/debugger_method_rewriter.cpp index 7a2871660bf1..05df891c2a69 100644 --- a/tracer/src/Datadog.Tracer.Native/debugger_method_rewriter.cpp +++ b/tracer/src/Datadog.Tracer.Native/debugger_method_rewriter.cpp @@ -386,15 +386,23 @@ WSTRING DebuggerMethodRewriter::GetInstrumentationId(RejitHandlerModule* moduleH return EmptyWStr; } +#ifdef MACOS std::wstringstream instrumentationIdStream; +#else + WSTRINGSTREAM instrumentationIdStream; +#endif instrumentationIdStream << WStr("M") << methodProbes.size() << WStr("L") << lineProbes.size() << WStr("S") << spanOnMethodProbes.size(); +#ifdef MACOS // Convert std::wstring to WSTRING std::wstring temp = instrumentationIdStream.str(); WSTRING converted(temp.begin(), temp.end()); return converted; +#else + return instrumentationIdStream.str(); +#endif } /// diff --git a/tracer/src/Datadog.Tracer.Native/iast/method_info.cpp b/tracer/src/Datadog.Tracer.Native/iast/method_info.cpp index 34fdc54dc919..df4f5358306b 100644 --- a/tracer/src/Datadog.Tracer.Native/iast/method_info.cpp +++ b/tracer/src/Datadog.Tracer.Native/iast/method_info.cpp @@ -72,7 +72,7 @@ namespace iast TypeInfo* MemberRefInfo::GetTypeInfo() { - if (!_typeInfo) + if (!_typeInfo) { _typeInfo = _module->GetTypeInfo(_typeDef); } @@ -433,7 +433,7 @@ namespace iast if (verify || dump) { - if (!_rewriter) + if (!_rewriter) { trace::Logger::Debug("MethodInfo::SetMethodIL -> No rewritter present. Creating one to verify new IL..."); @@ -445,7 +445,7 @@ namespace iast correct = false; } } - else + else { trace::Logger::Debug("MethodInfo::SetMethodIL -> Rewritter present. Verify new IL..."); } @@ -478,12 +478,12 @@ namespace iast if (pFunctionControl) { - trace::Logger::Debug("MethodInfo::SetMethodIL -> ReJIT : Setting IL for ", GetFullName().c_str()); + trace::Logger::Debug("MethodInfo::SetMethodIL -> ReJIT : Setting IL for ", GetFullName()); ApplyFinalInstrumentation(pFunctionControl); } else { - trace::Logger::Debug("MethodInfo::SetMethodIL -> JIT : Setting IL for ", GetFullName().c_str()); + trace::Logger::Debug("MethodInfo::SetMethodIL -> JIT : Setting IL for ", GetFullName()); } } else @@ -568,7 +568,7 @@ namespace iast FreeBuffer(); } - void MethodInfo::FreeBuffer() + void MethodInfo::FreeBuffer() { _nMethodIL = 0; DEL_ARR(_pMethodIL); diff --git a/tracer/test/Datadog.Tracer.Native.Tests/CMakeLists.txt b/tracer/test/Datadog.Tracer.Native.Tests/CMakeLists.txt index 96cf6ab3cc2c..8798c5a0023b 100644 --- a/tracer/test/Datadog.Tracer.Native.Tests/CMakeLists.txt +++ b/tracer/test/Datadog.Tracer.Native.Tests/CMakeLists.txt @@ -2,12 +2,12 @@ include(GoogleTest) # ****************************************************** # Compiler options # ****************************************************** -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) # Sets compiler options -add_compile_options(-std=c++17 -fms-extensions) +add_compile_options(-std=c++20 -fms-extensions) add_compile_options(-DPAL_STDCPP_COMPAT -DPLATFORM_UNIX -DUNICODE) -add_compile_options(-Wno-invalid-noreturn -Wno-macro-redefined -Wc++17-extensions) +add_compile_options(-Wno-invalid-noreturn -Wno-macro-redefined -Wc++20-extensions) if(ISLINUX) add_compile_options(-stdlib=libstdc++ -DLINUX -Wno-pragmas) @@ -59,7 +59,7 @@ target_link_libraries(${TEST_EXECUTABLE_NAME} -static-libgcc -static-libstdc++ -lstdc++fs - -Wc++17-extensions + -Wc++20-extensions ) gtest_discover_tests(${TEST_EXECUTABLE_NAME}) diff --git a/tracer/test/Datadog.Tracer.Native.Tests/Datadog.Tracer.Native.Tests.vcxproj b/tracer/test/Datadog.Tracer.Native.Tests/Datadog.Tracer.Native.Tests.vcxproj index aa17df0cbfe3..b1d1b98f8887 100644 --- a/tracer/test/Datadog.Tracer.Native.Tests/Datadog.Tracer.Native.Tests.vcxproj +++ b/tracer/test/Datadog.Tracer.Native.Tests/Datadog.Tracer.Native.Tests.vcxproj @@ -125,7 +125,7 @@ Disabled EnableFastChecks MultiThreadedDebug - stdcpp17 + stdcpp20 true pch.h Level3 @@ -144,7 +144,7 @@ MultiThreaded Level3 - stdcpp17 + stdcpp20 AnySuitable true Speed @@ -170,7 +170,7 @@ Disabled EnableFastChecks MultiThreadedDebug - stdcpp17 + stdcpp20 false true pch.h @@ -190,7 +190,7 @@ MultiThreaded Level3 - stdcpp17 + stdcpp20 AnySuitable true Speed @@ -216,7 +216,7 @@ Disabled EnableFastChecks MultiThreadedDebug - stdcpp17 + stdcpp20 false true pch.h @@ -236,7 +236,7 @@ MultiThreaded Level3 - stdcpp17 + stdcpp20 AnySuitable true Speed @@ -263,4 +263,4 @@ - + \ No newline at end of file