Visual Studio compiler warnings clean-up#315
Conversation
… - ignore if either of these isn't found
…try-cpp into maxgolov/compiler_warnings
Codecov Report
@@ Coverage Diff @@
## master #315 +/- ##
=======================================
Coverage 94.59% 94.60%
=======================================
Files 146 146
Lines 6629 6633 +4
=======================================
+ Hits 6271 6275 +4
Misses 358 358
|
|
Formatter on my Ubuntu 20.xx |
pyohannes
left a comment
There was a problem hiding this comment.
One question, otherwise this looks ok to me.
| namespace std | ||
| { | ||
| template <> | ||
| struct hash<OPENTELEMETRY_NAMESPACE::nostd::string_view> |
There was a problem hiding this comment.
Is this necessary for VS2015?
There was a problem hiding this comment.
No, sorry, this is a template that allows to use nostd::string_view as key in the std::map<nostd::string_view, ...> .. It's adding the missing functionality that otherwise exists for std::string_view
There was a problem hiding this comment.
That's what I meant under the couple helper routines umbrella in the PR description 😄
There was a problem hiding this comment.
Practical reason why I'm adding this: I'm working on a swap between nostd:: vs. std:: vs. absl:: ... Abseil will actually be required for Visual Studio 2015 (that's the only way how I can make backport of std::variant work). Some changes like this one, and adding a few headers here and there - are aligning overall code to potentially work with any replacement / substitute for nostd:: . Once this PR is merged, I'll follow-up to refresh my other PR with support for:
nostd::- default for anything vs2017+ and other OS.std::with msgsl - option for any compiler that supports C++17 and above, for customers who want to statically link the SDK and don't want to dynamically load prebuilt tracers.absl::- exotic flavor, currently only required for vs2015 (at least for the proper variant backport).
We can also potentially discuss that maybe we should switch from our nostd::variant to absl::variant, as Abseil's variant is at least definitely working on older compilers where ours is failing.
There was a problem hiding this comment.
I currently have all tests passing for nostd::, std:: + absl:: for Vs2015 in my branch here:
https://github.com/maxgolov/opentelemetry-cpp
I'm doing a matrix build with OpenTelemetry-provided containers vs. Standard Library Containers vs. Abseil (for vs2015 only).
|
I would prefer to keep the loop variables as (signed) ints and remove the warning flag instead. Context: https://google.github.io/styleguide/cppguide.html#Integer_Types |
This same rule says |
Update dependency rules_cue to v0.13.0
Partially addresses #249
Main goals:
size_tinstead ofintfor any index variable, even in tests. It's a bad coding practice to use signed integers for array index.std::andabsl::alternatives tonostd::classes where needed.I'll send in a separate PR for setting up CI for Visual Studio 2015, with
Warnings Level 4enabled, and subsequently breaking the build if somebody introduces a warning. That separate PR will also depend on replacingnostd::variantbyabsl::variant, because our built-in backport ofnostd::variantis not good ( see #314 ). Currently I'm testing out that flow in my fork.What is not addressed yet:
Since this will require refactor in the Metrics API, I am not touching those warnings, although they are actually "Level 2" warnings.