More fixes to build all with Visual Studio 2015 #840
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These are all the changes needed to compile OpenTelemetry C++ SDK with Visual Studio 2015.
I manually tested ad-hoc that the entire SDK works well with all optional component included.
Fixing warnings, errors, and warnings treated as errors.
Fixes #756
Partially addresses #215 , manually tested ad-hoc. No CI yet. CI loop (scripts, no code changes) will be added in #839
Changes
CMAKE_VERSION
check was not properly working on very OLD cmake lower than 3.3.b3_propagator.h
triggers an error about narrowing cast ofkTraceIdHexStrLength
. Add explicit static cast tosize_t
.nostd::variant_alternative_t
test does not compile in Visual Studio 2015. I suspect we are missing one of the headers. The rest of it works. And it's a lower priority - since we do not use any comparison of variant type in SDK, there should be no decrease in code coverage by disabling that test.ETW exporter: vs2015/C++ has no
__has_include
feature. And sinceTraceLoggingDynamic.h
is now always available - Microsoft open-sourced it under friendly license, we unconditionally include it. It's the best and standard compact binary protocol we should use on Windows for ETW, that can be easily decoded out-of-proc by .NET listener, for example.ETW exporter:
using
behavior in C++11 triggers ambiguity when the same class name is being aliased asusing
vs something else that is imported viausing namespace
. That doesn't happen on more recent versions of compilers. Explicitly assume that the ETW-specific wrapper classes (Properties,PropertyValue,PropertyValueMap) get imported viausing namespace
instead of alias, then it all works great.ETW exporter: avoid using
std::copy
since older compilers were picky about this due to Secure Lifecycle Development process. New compilers are more relaxed. But, unfortunately, we strive to run with zero compliance warnings on old compiler.__cplusplus
flag is not supported by old Visual Studio 2015. Add version check to avoid 'unknown flag` warning.