From 096c08b6b6dbd8645eebdccc8c06b83fa7a50cd3 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Sat, 16 Oct 2021 10:41:29 -0700 Subject: [PATCH] Remove unnecessary semicolon in ETW exporter (#1015) --- .../opentelemetry/exporters/etw/etw_logger.h | 2 +- .../exporters/etw/etw_properties.h | 47 ++++++++++--------- .../exporters/etw/etw_provider.h | 28 +++++------ .../opentelemetry/exporters/etw/etw_tracer.h | 32 ++++++------- .../opentelemetry/exporters/etw/uuid.h | 2 +- exporters/etw/test/etw_perf_test.cc | 8 ++-- 6 files changed, 61 insertions(+), 58 deletions(-) diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_logger.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_logger.h index 7ad67f049a..00653838bc 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_logger.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_logger.h @@ -76,7 +76,7 @@ class Logger : public logs::Logger { static ETWProvider instance; // C++11 magic static return instance; - }; + } /** * @brief Init a reference to etw::ProviderHandle diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h index c0f501e866..04ad86130f 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h @@ -83,7 +83,7 @@ class PropertyValue : public PropertyVariant static std::vector to_vector(const nostd::span &source) { return std::vector(source.begin(), source.end()); - }; + } /** * @brief Convert span to vector @@ -98,7 +98,7 @@ class PropertyValue : public PropertyVariant result.push_back(std::string(item.data())); } return result; - }; + } /** * @brief Convert vector to span. @@ -111,7 +111,7 @@ class PropertyValue : public PropertyVariant { nostd::span result(vec.data(), vec.size()); return result; - }; + } /** * @brief Convert vector to span. @@ -124,7 +124,7 @@ class PropertyValue : public PropertyVariant { nostd::span result(vec.data(), vec.size()); return result; - }; + } public: /** @@ -132,7 +132,7 @@ class PropertyValue : public PropertyVariant * @param v * @return */ - PropertyValue(bool value) : PropertyVariant(value){}; + PropertyValue(bool value) : PropertyVariant(value) {} /** * @brief PropertyValue from integral. @@ -140,7 +140,8 @@ class PropertyValue : public PropertyVariant * @return */ template ::value, bool> = true> - PropertyValue(TInteger number) : PropertyVariant(number){}; + PropertyValue(TInteger number) : PropertyVariant(number) + {} /** * @brief PropertyValue from floating point. @@ -148,14 +149,15 @@ class PropertyValue : public PropertyVariant * @return */ template ::value, bool> = true> - PropertyValue(TFloat number) : PropertyVariant(double(number)){}; + PropertyValue(TFloat number) : PropertyVariant(double(number)) + {} /** * @brief Default PropertyValue (int32_t=0) * @param v * @return */ - PropertyValue() : PropertyVariant(int32_t(0)){}; + PropertyValue() : PropertyVariant(int32_t(0)) {} /** * @brief PropertyValue from array of characters as string. @@ -163,7 +165,7 @@ class PropertyValue : public PropertyVariant * @param v * @return */ - PropertyValue(char value[]) : PropertyVariant(std::string(value)){}; + PropertyValue(char value[]) : PropertyVariant(std::string(value)) {} /** * @brief PropertyValue from array of characters as string. @@ -171,7 +173,7 @@ class PropertyValue : public PropertyVariant * @param v * @return */ - PropertyValue(const char *value) : PropertyVariant(std::string(value)){}; + PropertyValue(const char *value) : PropertyVariant(std::string(value)) {} /** * @brief PropertyValue from string. @@ -179,14 +181,15 @@ class PropertyValue : public PropertyVariant * @param v * @return */ - PropertyValue(const std::string &value) : PropertyVariant(value){}; + PropertyValue(const std::string &value) : PropertyVariant(value) {} /** * @brief PropertyValue from vector as array. * @return */ template - PropertyValue(std::vector value) : PropertyVariant(value){}; + PropertyValue(std::vector value) : PropertyVariant(value) + {} /** * @brief Convert owning PropertyValue to non-owning common::AttributeValue @@ -217,11 +220,11 @@ class PropertyValue : public PropertyVariant case common::AttributeType::kTypeCString: { PropertyVariant::operator=(nostd::get(v)); break; - }; + } case common::AttributeType::kTypeString: { PropertyVariant::operator=(nostd::string_view(nostd::get(v)).data()); break; - }; + } case common::AttributeType::kTypeSpanByte: PropertyVariant::operator=(to_vector(nostd::get>(v))); @@ -361,7 +364,7 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap /** * @brief PropertyValueMap constructor. */ - Properties() : PropertyValueMap(){}; + Properties() : PropertyValueMap() {} /** * @brief PropertyValueMap constructor from initializer list. @@ -369,7 +372,7 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap Properties(const std::initializer_list properties) : PropertyValueMap() { (*this) = (properties); - }; + } /** * @brief PropertyValueMap assignment operator from initializer list. @@ -378,12 +381,12 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap { PropertyValueMap::operator=(properties); return (*this); - }; + } /** * @brief PropertyValueMap constructor from map. */ - Properties(const PropertyValueMap &properties) : PropertyValueMap() { (*this) = properties; }; + Properties(const PropertyValueMap &properties) : PropertyValueMap() { (*this) = properties; } /** * @brief PropertyValueMap assignment operator from map. @@ -392,7 +395,7 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap { PropertyValueMap::operator=(properties); return (*this); - }; + } /** * @brief PropertyValueMap constructor from KeyValueIterable @@ -414,7 +417,7 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap return true; }); return (*this); - }; + } /** * @brief PropertyValueMap property accessor. @@ -439,12 +442,12 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap } } return true; - }; + } /** * @return the number of key-value pairs */ - size_t size() const noexcept override { return PropertyValueMap::size(); }; + size_t size() const noexcept override { return PropertyValueMap::size(); } }; } // namespace etw diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_provider.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_provider.h index 616f088187..5b00f05574 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_provider.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_provider.h @@ -161,8 +161,8 @@ class ETWProvider { data.refCount = 1; data.providerHandle = hProvider; - }; - }; + } + } break; #ifdef HAVE_MSGPACK @@ -180,7 +180,7 @@ class ETWProvider data.refCount = 1; data.providerHandle = hProvider; } - }; + } break; #endif @@ -232,7 +232,7 @@ class ETWProvider } return result; } - }; + } return STATUS_ERROR; } @@ -248,7 +248,7 @@ class ETWProvider { // Provider not registered! return STATUS_ERROR; - }; + } std::string eventName = "NoName"; auto nameField = eventData[ETW_FIELD_NAME]; @@ -361,7 +361,7 @@ class ETWProvider // TODO: unsupported type break; } - }; + } std::vector v = nlohmann::json::to_msgpack(jObj); @@ -385,7 +385,7 @@ class ETWProvider else { writeResponse = EventWrite(providerData.providerHandle, &evtDescriptor, 1, evtData); - }; + } switch (writeResponse) { @@ -401,12 +401,12 @@ class ETWProvider break; default: break; - }; + } if (writeResponse == ERROR_ARITHMETIC_OVERFLOW) { return STATUS_EFBIG; - }; + } return (unsigned long)(writeResponse); #else UNREFERENCED_PARAMETER(providerData); @@ -435,7 +435,7 @@ class ETWProvider { // Provider not registered! return STATUS_ERROR; - }; + } UINT32 eventTags = MICROSOFT_EVENTTAG_NORMAL_PERSISTENCE; @@ -539,7 +539,7 @@ class ETWProvider // TODO: unsupported type break; } - }; + } if (!builder.End()) // Returns false if the metadata is too large. { @@ -572,7 +572,7 @@ class ETWProvider if (writeResponse == HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW)) { return STATUS_EFBIG; - }; + } return (unsigned long)(writeResponse); } @@ -598,7 +598,7 @@ class ETWProvider return STATUS_ERROR; } return STATUS_ERROR; - }; + } static const REGHANDLE INVALID_HANDLE = _UI64_MAX; @@ -615,7 +615,7 @@ class ETWProvider { static std::map providers; return providers; - }; + } }; OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h index bad00dde58..cd157f34d5 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h @@ -190,7 +190,7 @@ class Tracer : public trace::Tracer { static ETWProvider instance; // C++11 magic static return instance; - }; + } /** * @brief Internal method that allows to populate Links to other Spans. @@ -219,7 +219,7 @@ class Tracer : public trace::Tracer }); attributes[ETW_FIELD_SPAN_LINKS] = linksValue; } - }; + } /** * @brief Allow our friendly etw::Span to end itself on Tracer. @@ -320,9 +320,9 @@ class Tracer : public trace::Tracer UpdateStatus(currentSpan, evt); etwProvider().write(provHandle, evt, ActivityIdPtr, RelatedActivityIdPtr, 0, encoding); } - }; + } - const trace::TraceId &trace_id() { return traceId_; }; + const trace::TraceId &trace_id() { return traceId_; } friend class Span; @@ -360,7 +360,7 @@ class Tracer : public trace::Tracer nostd::span traceIdBytes( traceIdPtr, traceIdPtr + trace::TraceId::kSize); traceId_ = trace::TraceId(traceIdBytes); - }; + } /** * @brief Start Span @@ -486,10 +486,10 @@ class Tracer : public trace::Tracer // - options.start_steady_time // - options.start_system_time etwProvider().write(provHandle, evt, ActivityIdPtr, RelatedActivityIdPtr, 1, encoding); - }; + } return result; - }; + } /** * @brief Force flush data to Tracer, spending up to given amount of microseconds to flush. @@ -498,7 +498,7 @@ class Tracer : public trace::Tracer * @param timeout Allow Tracer to drop data if timeout is reached * @return */ - void ForceFlushWithMicroseconds(uint64_t) noexcept override{}; + void ForceFlushWithMicroseconds(uint64_t) noexcept override {} /** * @brief Close tracer, spending up to given amount of microseconds to flush and close. @@ -515,7 +515,7 @@ class Tracer : public trace::Tracer { etwProvider().close(provHandle); } - }; + } /** * @brief Add event data to span associated with tracer. @@ -601,7 +601,7 @@ class Tracer : public trace::Tracer #endif etwProvider().write(provHandle, evt, ActivityIdPtr, nullptr, 0, encoding); - }; + } /** * @brief Add event data to span associated with tracer. @@ -615,7 +615,7 @@ class Tracer : public trace::Tracer common::SystemTimestamp timestamp) noexcept { AddEvent(span, name, timestamp, sdk::GetEmptyAttributes()); - }; + } /** * @brief Add event data to span associated with tracer. @@ -625,12 +625,12 @@ class Tracer : public trace::Tracer void AddEvent(trace::Span &span, nostd::string_view name) { AddEvent(span, name, std::chrono::system_clock::now(), sdk::GetEmptyAttributes()); - }; + } /** * @brief Tracer destructor. */ - virtual ~Tracer() { CloseWithMicroseconds(0); }; + virtual ~Tracer() { CloseWithMicroseconds(0); } }; /** @@ -766,7 +766,7 @@ class Span : public trace::Span { name_ = name; UNREFERENCED_PARAMETER(options); - }; + } /** * @brief Span Destructor @@ -840,7 +840,7 @@ class Span : public trace::Span // TODO: not implemented UNREFERENCED_PARAMETER(key); UNREFERENCED_PARAMETER(value); - }; + } /** * @brief Update Span name. @@ -900,7 +900,7 @@ class Span : public trace::Span /// Get Owner tracer of this Span /// /// - trace::Tracer &tracer() const noexcept { return this->owner_; }; + trace::Tracer &tracer() const noexcept { return this->owner_; } }; /** diff --git a/exporters/etw/include/opentelemetry/exporters/etw/uuid.h b/exporters/etw/include/opentelemetry/exporters/etw/uuid.h index ca1a58ac94..a004aec9e3 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/uuid.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/uuid.h @@ -67,7 +67,7 @@ struct UUID { Data4[i] = 0; } - }; + } /// /// A constructor that creates a UUID object from a hyphenated string as defined by diff --git a/exporters/etw/test/etw_perf_test.cc b/exporters/etw/test/etw_perf_test.cc index d20e3b553c..79052464e8 100644 --- a/exporters/etw/test/etw_perf_test.cc +++ b/exporters/etw/test/etw_perf_test.cc @@ -132,7 +132,7 @@ void BM_AddPropertiesToTracer(benchmark::State &state) while (state.KeepRunning()) { benchmark::DoNotOptimize(provider.AddProperties()); - }; + } provider.Teardown(); } BENCHMARK(BM_AddPropertiesToTracer); @@ -147,7 +147,7 @@ void BM_AddPropertiesStaticToTracer(benchmark::State &state) while (state.KeepRunning()) { benchmark::DoNotOptimize(provider.AddPropertiesStatic()); - }; + } provider.Teardown(); } BENCHMARK(BM_AddPropertiesStaticToTracer); @@ -162,7 +162,7 @@ void BM_AddInitListToTracer(benchmark::State &state) while (state.KeepRunning()) { benchmark::DoNotOptimize(provider.AddInitList()); - }; + } provider.Teardown(); } BENCHMARK(BM_AddInitListToTracer); @@ -178,7 +178,7 @@ void BM_AddMapToTracer(benchmark::State &state) while (state.KeepRunning()) { benchmark::DoNotOptimize(provider.AddMap()); - }; + } provider.Teardown(); } BENCHMARK(BM_AddMapToTracer);