Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more clang and gcc warnings #1658

Merged
merged 3 commits into from
Oct 5, 2022

Conversation

marcalff
Copy link
Member

@marcalff marcalff commented Oct 5, 2022

Fixes #1649

Changes

Fixed some warnings reported by clang.

-Wnewline-eof
no newline at end of file

-Wc++98-compat-extra-semi
extra ';' outside of a function is incompatible with C++98

-Winconsistent-missing-destructor-override
'~XXX' overrides a destructor but is not marked 'override'

-Wheader-hygiene
using namespace directive in global context in header

-Wunused-parameter
unused parameter

-Wrange-loop-bind-reference

/home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_populate_attribute_utils.cc:179:22: error: loop variable 'val' binds to a temporary value produced by a range of type 'const std::vector<bool>' [-Werror,-Wrange-loop-bind-reference]
    for (const auto &val : nostd::get<std::vector<bool>>(value))
                     ^
/home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_populate_attribute_utils.cc:179:10: note: use non-reference type 'bool'
    for (const auto &val : nostd::get<std::vector<bool>>(value))
         ^~~~~~~~~~~~~~~~~

Fixed some warnings reported by gcc.

-Werror=missing-field-initializers
missing initializer for member ‘opentelemetry::v1::sdk::trace::SamplingResult::trace_state’

-Werror=unused-variable
unused variable

-Werror=unused-parameter
unused parameter

Added override keywords, and fixed casts to use const_cast.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Fixed some warnings reported by clang.

-Wnewline-eof
  no newline at end of file

-Wc++98-compat-extra-semi
  extra ';' outside of a function is incompatible with C++98

-Winconsistent-missing-destructor-override
  '~XXX' overrides a destructor but is not marked 'override'

-Wheader-hygiene
  using namespace directive in global context in header

-Wunused-parameter
  unused parameter

Fixed some warnings reported by gcc.

-Werror=missing-field-initializers
  missing initializer for member ‘opentelemetry::v1::sdk::trace::SamplingResult::trace_state’

-Werror=unused-variable
  unused variable

-Werror=unused-parameter
  unused parameter
@marcalff marcalff requested a review from a team October 5, 2022 07:45
@codecov
Copy link

codecov bot commented Oct 5, 2022

Codecov Report

Merging #1658 (65d7557) into main (7724361) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1658      +/-   ##
==========================================
+ Coverage   84.39%   84.41%   +0.03%     
==========================================
  Files         168      170       +2     
  Lines        5122     5130       +8     
==========================================
+ Hits         4322     4330       +8     
  Misses        800      800              
Impacted Files Coverage Δ
api/include/opentelemetry/common/kv_properties.h 98.96% <ø> (ø)
...lemetry/context/propagation/composite_propagator.h 100.00% <ø> (ø)
api/include/opentelemetry/trace/context.h 100.00% <ø> (ø)
...ude/opentelemetry/exporters/ostream/common_utils.h 100.00% <ø> (ø)
...clude/opentelemetry/sdk/common/attributemap_hash.h 76.48% <ø> (ø)
...metry/sdk/metrics/aggregation/aggregation_config.h 100.00% <ø> (ø)
...clude/opentelemetry/sdk/metrics/sync_instruments.h 100.00% <ø> (ø)
...ntelemetry/sdk/metrics/view/attributes_processor.h 100.00% <ø> (ø)
...ude/opentelemetry/sdk/metrics/view/view_registry.h 93.75% <ø> (ø)
sdk/include/opentelemetry/sdk/trace/id_generator.h 100.00% <ø> (ø)
... and 11 more

Copy link
Member

@owent owent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@esigo esigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks for the fixes :)

@lalitb lalitb merged commit 1dc810d into open-telemetry:main Oct 5, 2022
yxue pushed a commit to yxue/opentelemetry-cpp that referenced this pull request Dec 5, 2022
Fixed some warnings reported by clang.

-Wnewline-eof
  no newline at end of file

-Wc++98-compat-extra-semi
  extra ';' outside of a function is incompatible with C++98

-Winconsistent-missing-destructor-override
  '~XXX' overrides a destructor but is not marked 'override'

-Wheader-hygiene
  using namespace directive in global context in header

-Wunused-parameter
  unused parameter

Fixed some warnings reported by gcc.

-Werror=missing-field-initializers
  missing initializer for member ‘opentelemetry::v1::sdk::trace::SamplingResult::trace_state’

-Werror=unused-variable
  unused variable

-Werror=unused-parameter
  unused parameter
@marcalff marcalff deleted the fix_clang_warning_1649 branch July 4, 2023 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUILD] Build warnings reported by clang.
4 participants