From 1c5ea5eb3a9adbc3adc4a3a36a6cf09f7fa05bf1 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 28 Mar 2024 14:55:27 -0400 Subject: [PATCH] Change naming convention for enum class enumerators Change the naming convention for enum class enumerators to not use `ALL_CAPS`, as suggested by the C++ Core Guidelines [1]. Instead, use camel case starting with a capital letter. Update `CONTRIBUTING.adoc` to reflect this change. gcc emits warnings like this: /home/smarchi/src/babeltrace/src/cpp-common/bt2/trace-ir.hpp:880:9: error: declaration of 'bt2::CommonEventClass::LogLevel::Error' shadows a global declaration [-Werror=shadow] 880 | Error = BT_EVENT_CLASS_LOG_LEVEL_ERROR, | ^~~~~ In file included from /home/smarchi/src/babeltrace/src/cpp-common/bt2/clock-class.hpp:20, from /home/smarchi/src/babeltrace/src/clock-correlation-validator/clock-correlation-validator.cpp:7: /home/smarchi/src/babeltrace/src/cpp-common/bt2/exc.hpp:14:7: note: shadowed declaration is here 14 | using Error = bt2c::Error; | ^~~~~ Whether or not this is a compiler bug is not clear [2], but in our case we know it's fine. Add and use `BT_DIAG_IGNORE_SHADOW` in some places to silence these warnings. [1] https://cpp-core-guidelines-docs.vercel.app/enum#Renum-caps [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55776 Change-Id: I59bb7f3c8572106c325596bc80a4d70714d86dee Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/12212 Reviewed-by: Philippe Proulx Tested-by: jenkins --- CONTRIBUTING.adoc | 8 +- .../clock-correlation-validator.cpp | 106 +++++++--------- .../clock-correlation-validator.hpp | 30 ++--- src/common/macros.h | 5 + src/cpp-common/bt2/component-class-dev.hpp | 24 ++-- src/cpp-common/bt2/component-class.hpp | 6 +- src/cpp-common/bt2/error.hpp | 14 +- src/cpp-common/bt2/field-class.hpp | 49 ++++--- src/cpp-common/bt2/field-path.hpp | 14 +- src/cpp-common/bt2/graph.hpp | 12 +- src/cpp-common/bt2/logging.hpp | 22 +++- src/cpp-common/bt2/message.hpp | 32 ++--- src/cpp-common/bt2/trace-ir.hpp | 37 +++--- src/cpp-common/bt2/value.hpp | 16 +-- src/cpp-common/bt2c/logging.hpp | 120 +++++++++--------- src/plugins/utils/muxer/msg-iter.cpp | 22 ++-- src/plugins/utils/muxer/upstream-msg-iter.cpp | 20 +-- src/plugins/utils/muxer/upstream-msg-iter.hpp | 4 +- .../clk-cls-compat-postconds-triggers.cpp | 20 +-- tests/lib/conds/conds-triggers.cpp | 8 +- tests/lib/conds/utils.cpp | 2 +- tests/lib/conds/utils.hpp | 4 +- .../test-clock-compatibility.cpp | 24 ++-- 23 files changed, 305 insertions(+), 294 deletions(-) diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index 431a1669..35f4923c 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -1897,10 +1897,10 @@ $ FORMATTER='my-clang-format-15 -i' ./tools/format-cpp.sh * Use camel case with an uppercase first letter for: ** Types: `Pistachio`, `NutManager`. ** Template parameters: `PlanetT`, `TotalSize`. +** Enumerators: `Type::SignedInt`, `Scope::Function`. * Use snake case with uppercase letters for: ** Definition/macro names: `MARK_AS_UNUSED()`, `SOME_FEATURE_EXISTS`. -** Enumerators: `Type::SIGNED_INT`, `Scope::FUNCTION`. * Use only lowercase letters and digits for namespaces: `mylib`, `bt2`. @@ -2222,9 +2222,9 @@ public: enum class Gender { - MALE, - FEMALE, - OTHER, + Male, + Female, + Other, }; explicit Baby() = default; diff --git a/src/clock-correlation-validator/clock-correlation-validator.cpp b/src/clock-correlation-validator/clock-correlation-validator.cpp index a116c364..4bb1a725 100644 --- a/src/clock-correlation-validator/clock-correlation-validator.cpp +++ b/src/clock-correlation-validator/clock-correlation-validator.cpp @@ -19,12 +19,12 @@ void ClockCorrelationValidator::_validate(const bt2::ConstMessage msg) bt2::OptionalBorrowedObject streamCls; switch (msg.type()) { - case bt2::MessageType::STREAM_BEGINNING: + case bt2::MessageType::StreamBeginning: streamCls = msg.asStreamBeginning().stream().cls(); clockCls = streamCls->defaultClockClass(); break; - case bt2::MessageType::MESSAGE_ITERATOR_INACTIVITY: + case bt2::MessageType::MessageIteratorInactivity: clockCls = msg.asMessageIteratorInactivity().clockSnapshot().clockClass(); break; @@ -33,93 +33,87 @@ void ClockCorrelationValidator::_validate(const bt2::ConstMessage msg) } switch (_mExpectation) { - case PropsExpectation::UNSET: + case PropsExpectation::Unset: /* * This is the first analysis of a message with a clock * snapshot: record the properties of that clock, against which * we'll compare the clock properties of the following messages. */ if (!clockCls) { - _mExpectation = PropsExpectation::NONE; + _mExpectation = PropsExpectation::None; } else if (clockCls->originIsUnixEpoch()) { - _mExpectation = PropsExpectation::ORIGIN_UNIX; + _mExpectation = PropsExpectation::OriginUnix; } else if (const auto uuid = clockCls->uuid()) { - _mExpectation = PropsExpectation::ORIGIN_OTHER_UUID; + _mExpectation = PropsExpectation::OriginOtherUuid; _mUuid = *uuid; } else { - _mExpectation = PropsExpectation::ORIGIN_OTHER_NO_UUID; + _mExpectation = PropsExpectation::OriginOtherNoUuid; _mClockClass = clockCls->shared(); } break; - case PropsExpectation::NONE: + case PropsExpectation::None: if (clockCls) { - throw ClockCorrelationError { - ClockCorrelationError::Type::EXPECTING_NO_CLOCK_CLASS_GOT_ONE, - bt2s::nullopt, - *clockCls, - {}, - streamCls}; + throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingNoClockClassGotOne, + bt2s::nullopt, + *clockCls, + {}, + streamCls}; } break; - case PropsExpectation::ORIGIN_UNIX: + case PropsExpectation::OriginUnix: if (!clockCls) { - throw ClockCorrelationError { - ClockCorrelationError::Type::EXPECTING_ORIGIN_UNIX_GOT_NONE, - bt2s::nullopt, - {}, - {}, - streamCls}; + throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginUnixGotNone, + bt2s::nullopt, + {}, + {}, + streamCls}; } if (!clockCls->originIsUnixEpoch()) { - throw ClockCorrelationError { - ClockCorrelationError::Type::EXPECTING_ORIGIN_UNIX_GOT_OTHER, - bt2s::nullopt, - *clockCls, - {}, - streamCls}; + throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginUnixGotOther, + bt2s::nullopt, + *clockCls, + {}, + streamCls}; } break; - case PropsExpectation::ORIGIN_OTHER_UUID: + case PropsExpectation::OriginOtherUuid: { if (!clockCls) { - throw ClockCorrelationError { - ClockCorrelationError::Type::EXPECTING_ORIGIN_UUID_GOT_NONE, - bt2s::nullopt, - {}, - {}, - streamCls}; + throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginUuidGotNone, + bt2s::nullopt, + {}, + {}, + streamCls}; } if (clockCls->originIsUnixEpoch()) { - throw ClockCorrelationError { - ClockCorrelationError::Type::EXPECTING_ORIGIN_UUID_GOT_UNIX, - bt2s::nullopt, - *clockCls, - {}, - streamCls}; + throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginUuidGotUnix, + bt2s::nullopt, + *clockCls, + {}, + streamCls}; } const auto uuid = clockCls->uuid(); if (!uuid) { - throw ClockCorrelationError { - ClockCorrelationError::Type::EXPECTING_ORIGIN_UUID_GOT_NO_UUID, - bt2s::nullopt, - *clockCls, - {}, - streamCls}; + throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginUuidGotNoUuid, + bt2s::nullopt, + *clockCls, + {}, + streamCls}; } if (*uuid != _mUuid) { throw ClockCorrelationError { - ClockCorrelationError::Type::EXPECTING_ORIGIN_UUID_GOT_OTHER_UUID, + ClockCorrelationError::Type::ExpectingOriginUuidGotOtherUuid, _mUuid, *clockCls, {}, @@ -129,20 +123,18 @@ void ClockCorrelationValidator::_validate(const bt2::ConstMessage msg) break; } - case PropsExpectation::ORIGIN_OTHER_NO_UUID: + case PropsExpectation::OriginOtherNoUuid: if (!clockCls) { - throw ClockCorrelationError { - ClockCorrelationError::Type::EXPECTING_ORIGIN_NO_UUID_GOT_NONE, - bt2s::nullopt, - {}, - {}, - streamCls}; + throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginNoUuidGotNone, + bt2s::nullopt, + {}, + {}, + streamCls}; } if (clockCls->libObjPtr() != _mClockClass->libObjPtr()) { - throw ClockCorrelationError { - ClockCorrelationError::Type::EXPECTING_ORIGIN_NO_UUID_GOT_OTHER, bt2s::nullopt, - *clockCls, *_mClockClass, streamCls}; + throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginNoUuidGotOther, + bt2s::nullopt, *clockCls, *_mClockClass, streamCls}; } break; diff --git a/src/clock-correlation-validator/clock-correlation-validator.hpp b/src/clock-correlation-validator/clock-correlation-validator.hpp index 773c97cb..314551c3 100644 --- a/src/clock-correlation-validator/clock-correlation-validator.hpp +++ b/src/clock-correlation-validator/clock-correlation-validator.hpp @@ -18,23 +18,23 @@ class ClockCorrelationError final : public std::runtime_error public: enum class Type { - EXPECTING_NO_CLOCK_CLASS_GOT_ONE = + ExpectingNoClockClassGotOne = BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_NO_CLOCK_CLASS_GOT_ONE, - EXPECTING_ORIGIN_UNIX_GOT_NONE = + ExpectingOriginUnixGotNone = BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_NONE, - EXPECTING_ORIGIN_UNIX_GOT_OTHER = + ExpectingOriginUnixGotOther = BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_OTHER, - EXPECTING_ORIGIN_UUID_GOT_NONE = + ExpectingOriginUuidGotNone = BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_NONE, - EXPECTING_ORIGIN_UUID_GOT_UNIX = + ExpectingOriginUuidGotUnix = BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_UNIX, - EXPECTING_ORIGIN_UUID_GOT_NO_UUID = + ExpectingOriginUuidGotNoUuid = BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_NO_UUID, - EXPECTING_ORIGIN_UUID_GOT_OTHER_UUID = + ExpectingOriginUuidGotOtherUuid = BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_OTHER_UUID, - EXPECTING_ORIGIN_NO_UUID_GOT_NONE = + ExpectingOriginNoUuidGotNone = BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_NO_UUID_GOT_NONE, - EXPECTING_ORIGIN_NO_UUID_GOT_OTHER = + ExpectingOriginNoUuidGotOther = BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_NO_UUID_GOT_OTHER, }; @@ -89,19 +89,19 @@ private: enum class PropsExpectation { /* We haven't recorded clock properties yet. */ - UNSET, + Unset, /* Expect to have no clock. */ - NONE, + None, /* Expect a clock with a Unix epoch origin. */ - ORIGIN_UNIX, + OriginUnix, /* Expect a clock without a Unix epoch origin, but with a UUID. */ - ORIGIN_OTHER_UUID, + OriginOtherUuid, /* Expect a clock without a Unix epoch origin and without a UUID. */ - ORIGIN_OTHER_NO_UUID, + OriginOtherNoUuid, }; public: @@ -117,7 +117,7 @@ public: private: void _validate(const bt2::ConstMessage msg); - PropsExpectation _mExpectation = PropsExpectation::UNSET; + PropsExpectation _mExpectation = PropsExpectation::Unset; /* * Expected UUID of the clock, if `_mExpectation` is diff --git a/src/common/macros.h b/src/common/macros.h index 13ba2d36..8120515c 100644 --- a/src/common/macros.h +++ b/src/common/macros.h @@ -99,6 +99,11 @@ extern "C" { ((void) sizeof((void) (_expr1), (void) (_expr2), \ (void) (_expr3), (void) (_expr4), (void) (_expr5), 0)) +#define BT_DIAG_PUSH _Pragma ("GCC diagnostic push") +#define BT_DIAG_POP _Pragma ("GCC diagnostic push") + +#define BT_DIAG_IGNORE_SHADOW _Pragma("GCC diagnostic ignored \"-Wshadow\"") + #if defined __clang__ # if __has_warning("-Wunused-but-set-variable") # define BT_DIAG_IGNORE_UNUSED_BUT_SET_VARIABLE \ diff --git a/src/cpp-common/bt2/component-class-dev.hpp b/src/cpp-common/bt2/component-class-dev.hpp index b89ac6b2..e0d45d6b 100644 --- a/src/cpp-common/bt2/component-class-dev.hpp +++ b/src/cpp-common/bt2/component-class-dev.hpp @@ -471,9 +471,9 @@ private: /* Type of `_mExcToThrowType` */ enum class _ExcToThrowType { - NONE, - ERROR, - MEM_ERROR, + None, + Error, + MemError, }; protected: @@ -489,17 +489,17 @@ public: void next(ConstMessageArray& messages) { /* Any saved error? Now is the time to throw */ - if (G_UNLIKELY(_mExcToThrowType != _ExcToThrowType::NONE)) { + if (G_UNLIKELY(_mExcToThrowType != _ExcToThrowType::None)) { /* Move `_mSavedLibError`, if any, as current thread error */ if (_mSavedLibError) { bt_current_thread_move_error(_mSavedLibError.release()); } /* Throw the corresponding exception */ - if (_mExcToThrowType == _ExcToThrowType::ERROR) { + if (_mExcToThrowType == _ExcToThrowType::Error) { throw Error {}; } else { - BT_ASSERT(_mExcToThrowType == _ExcToThrowType::MEM_ERROR); + BT_ASSERT(_mExcToThrowType == _ExcToThrowType::MemError); throw MemoryError {}; } } @@ -513,7 +513,7 @@ public: * if any, so that we can restore it later (see the beginning of * this method). */ - BT_ASSERT_DBG(_mExcToThrowType == _ExcToThrowType::NONE); + BT_ASSERT_DBG(_mExcToThrowType == _ExcToThrowType::None); try { this->_userObj()._next(messages); @@ -529,16 +529,16 @@ public: throw; } - _mExcToThrowType = _ExcToThrowType::MEM_ERROR; + _mExcToThrowType = _ExcToThrowType::MemError; } catch (const Error&) { if (messages.isEmpty()) { throw; } - _mExcToThrowType = _ExcToThrowType::ERROR; + _mExcToThrowType = _ExcToThrowType::Error; } - if (_mExcToThrowType != _ExcToThrowType::NONE) { + if (_mExcToThrowType != _ExcToThrowType::None) { BT_CPPLOGE( "An error occurred, but there are {} messages to return: delaying the error reporting.", messages.length()); @@ -716,7 +716,7 @@ private: void _resetError() noexcept { - _mExcToThrowType = _ExcToThrowType::NONE; + _mExcToThrowType = _ExcToThrowType::None; _mSavedLibError.reset(); } @@ -730,7 +730,7 @@ private: * * It also saves the type of the exception to throw the next time. */ - _ExcToThrowType _mExcToThrowType = _ExcToThrowType::NONE; + _ExcToThrowType _mExcToThrowType = _ExcToThrowType::None; struct LibErrorDeleter final { diff --git a/src/cpp-common/bt2/component-class.hpp b/src/cpp-common/bt2/component-class.hpp index e32ba34a..3d30ad35 100644 --- a/src/cpp-common/bt2/component-class.hpp +++ b/src/cpp-common/bt2/component-class.hpp @@ -54,9 +54,9 @@ public: enum class Type { - SOURCE = BT_COMPONENT_CLASS_TYPE_SOURCE, - FILTER = BT_COMPONENT_CLASS_TYPE_FILTER, - SINK = BT_COMPONENT_CLASS_TYPE_SINK, + Source = BT_COMPONENT_CLASS_TYPE_SOURCE, + Filter = BT_COMPONENT_CLASS_TYPE_FILTER, + Sink = BT_COMPONENT_CLASS_TYPE_SINK, }; explicit CommonComponentClass(const LibObjPtr libObjPtr) noexcept : diff --git a/src/cpp-common/bt2/error.hpp b/src/cpp-common/bt2/error.hpp index 7daaaf6b..030ff239 100644 --- a/src/cpp-common/bt2/error.hpp +++ b/src/cpp-common/bt2/error.hpp @@ -30,10 +30,10 @@ class ConstErrorCause : public BorrowedObject public: enum class ActorType { - UNKNOWN = BT_ERROR_CAUSE_ACTOR_TYPE_UNKNOWN, - COMPONENT = BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT, - COMPONENT_CLASS = BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT_CLASS, - MESSAGE_ITERATOR = BT_ERROR_CAUSE_ACTOR_TYPE_MESSAGE_ITERATOR, + Unknown = BT_ERROR_CAUSE_ACTOR_TYPE_UNKNOWN, + Component = BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT, + ComponentClass = BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT_CLASS, + MessageIterator = BT_ERROR_CAUSE_ACTOR_TYPE_MESSAGE_ITERATOR, }; explicit ConstErrorCause(const LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} @@ -47,17 +47,17 @@ public: bool actorTypeIsComponentClass() const noexcept { - return this->actorType() == ActorType::COMPONENT_CLASS; + return this->actorType() == ActorType::ComponentClass; } bool actorTypeIsComponent() const noexcept { - return this->actorType() == ActorType::COMPONENT; + return this->actorType() == ActorType::Component; } bool actorTypeIsMessageIterator() const noexcept { - return this->actorType() == ActorType::MESSAGE_ITERATOR; + return this->actorType() == ActorType::MessageIterator; } ConstComponentClassErrorCause asComponentClass() const noexcept; diff --git a/src/cpp-common/bt2/field-class.hpp b/src/cpp-common/bt2/field-class.hpp index 411cf669..83cd5215 100644 --- a/src/cpp-common/bt2/field-class.hpp +++ b/src/cpp-common/bt2/field-class.hpp @@ -135,29 +135,28 @@ class CommonTraceClass; enum class FieldClassType { - BOOL = BT_FIELD_CLASS_TYPE_BOOL, - BIT_ARRAY = BT_FIELD_CLASS_TYPE_BIT_ARRAY, - UNSIGNED_INTEGER = BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER, - SIGNED_INTEGER = BT_FIELD_CLASS_TYPE_SIGNED_INTEGER, - UNSIGNED_ENUMERATION = BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, - SIGNED_ENUMERATION = BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, - SINGLE_PRECISION_REAL = BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL, - DOUBLE_PRECISION_REAL = BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL, - STRING = BT_FIELD_CLASS_TYPE_STRING, - STRUCTURE = BT_FIELD_CLASS_TYPE_STRUCTURE, - STATIC_ARRAY = BT_FIELD_CLASS_TYPE_STATIC_ARRAY, - DYNAMIC_ARRAY_WITHOUT_LENGTH = BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD, - DYNAMIC_ARRAY_WITH_LENGTH = BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD, - OPTION_WITHOUT_SELECTOR = BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD, - OPTION_WITH_BOOL_SELECTOR = BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD, - OPTION_WITH_UNSIGNED_INTEGER_SELECTOR = + Bool = BT_FIELD_CLASS_TYPE_BOOL, + BitArray = BT_FIELD_CLASS_TYPE_BIT_ARRAY, + UnsignedInteger = BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER, + SignedInteger = BT_FIELD_CLASS_TYPE_SIGNED_INTEGER, + UnsignedEnumeration = BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, + SignedEnumeration = BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, + SinglePrecisionReal = BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL, + DoublePrecisionReal = BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL, + String = BT_FIELD_CLASS_TYPE_STRING, + Structure = BT_FIELD_CLASS_TYPE_STRUCTURE, + StaticArray = BT_FIELD_CLASS_TYPE_STATIC_ARRAY, + DynamicArrayWithoutLength = BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD, + DynamicArrayWithLength = BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD, + OptionWithoutSelector = BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD, + OptionWithBoolSelector = BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD, + OptionWithUnsignedIntegerSelector = BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD, - OPTION_WITH_SIGNED_INTEGER_SELECTOR = - BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD, - VARIANT_WITHOUT_SELECTOR = BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD, - VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR = + OptionWithSignedIntegerSelector = BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD, + VariantWithoutSelector = BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD, + VariantWithUnsignedIntegerSelector = BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD, - VARIANT_WITH_SIGNED_INTEGER_SELECTOR = + VariantWithSignedIntegerSelector = BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD, }; @@ -522,10 +521,10 @@ struct TypeDescr : public BitArrayFieldClassTypeDescr enum class DisplayBase { - BINARY = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY, - OCTAL = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL, - DECIMAL = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL, - HEXADECIMAL = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL, + Binary = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY, + Octal = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL, + Decimal = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL, + Hexadecimal = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL, }; template diff --git a/src/cpp-common/bt2/field-path.hpp b/src/cpp-common/bt2/field-path.hpp index fc087593..d203245f 100644 --- a/src/cpp-common/bt2/field-path.hpp +++ b/src/cpp-common/bt2/field-path.hpp @@ -23,9 +23,9 @@ class ConstIndexFieldPathItem; enum class FieldPathItemType { - INDEX = BT_FIELD_PATH_ITEM_TYPE_INDEX, - CURRENT_ARRAY_ELEMENT = BT_FIELD_PATH_ITEM_TYPE_CURRENT_ARRAY_ELEMENT, - CURRENT_OPTION_CONTENT = BT_FIELD_PATH_ITEM_TYPE_CURRENT_OPTION_CONTENT, + Index = BT_FIELD_PATH_ITEM_TYPE_INDEX, + CurrentArrayElement = BT_FIELD_PATH_ITEM_TYPE_CURRENT_ARRAY_ELEMENT, + CurrentOptionContent = BT_FIELD_PATH_ITEM_TYPE_CURRENT_OPTION_CONTENT, }; class ConstFieldPathItem : public BorrowedObject @@ -110,10 +110,10 @@ public: enum class Scope { - PACKET_CONTEXT = BT_FIELD_PATH_SCOPE_PACKET_CONTEXT, - EVENT_COMMON_CONTEXT = BT_FIELD_PATH_SCOPE_EVENT_COMMON_CONTEXT, - EVENT_SPECIFIC_CONTEXT = BT_FIELD_PATH_SCOPE_EVENT_SPECIFIC_CONTEXT, - EVENT_PAYLOAD = BT_FIELD_PATH_SCOPE_EVENT_PAYLOAD, + PacketContext = BT_FIELD_PATH_SCOPE_PACKET_CONTEXT, + EventCommonContext = BT_FIELD_PATH_SCOPE_EVENT_COMMON_CONTEXT, + EventSpecificContext = BT_FIELD_PATH_SCOPE_EVENT_SPECIFIC_CONTEXT, + EventPayload = BT_FIELD_PATH_SCOPE_EVENT_PAYLOAD, }; explicit ConstFieldPath(const LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} diff --git a/src/cpp-common/bt2/graph.hpp b/src/cpp-common/bt2/graph.hpp index 0927cd30..e2bcf77c 100644 --- a/src/cpp-common/bt2/graph.hpp +++ b/src/cpp-common/bt2/graph.hpp @@ -57,7 +57,7 @@ public: ConstSourceComponent addComponent(const ConstSourceComponentClass componentClass, const bt2c::CStringView name, const OptionalBorrowedObject params = {}, - const LoggingLevel loggingLevel = LoggingLevel::NONE) const + const LoggingLevel loggingLevel = LoggingLevel::None) const { return this->_addComponent( componentClass, name, params, static_cast(nullptr), loggingLevel, @@ -68,7 +68,7 @@ public: ConstSourceComponent addComponent(const ConstSourceComponentClass componentClass, const bt2c::CStringView name, InitDataT&& initData, const OptionalBorrowedObject params = {}, - const LoggingLevel loggingLevel = LoggingLevel::NONE) const + const LoggingLevel loggingLevel = LoggingLevel::None) const { return this->_addComponent( componentClass, name, params, &initData, loggingLevel, @@ -78,7 +78,7 @@ public: ConstFilterComponent addComponent(const ConstFilterComponentClass componentClass, const bt2c::CStringView name, const OptionalBorrowedObject params = {}, - const LoggingLevel loggingLevel = LoggingLevel::NONE) const + const LoggingLevel loggingLevel = LoggingLevel::None) const { return this->_addComponent( componentClass, name, params, static_cast(nullptr), loggingLevel, @@ -89,7 +89,7 @@ public: ConstFilterComponent addComponent(const ConstFilterComponentClass componentClass, const bt2c::CStringView name, InitDataT&& initData, const OptionalBorrowedObject params = {}, - const LoggingLevel loggingLevel = LoggingLevel::NONE) const + const LoggingLevel loggingLevel = LoggingLevel::None) const { return this->_addComponent( componentClass, name, params, &initData, loggingLevel, @@ -99,7 +99,7 @@ public: ConstSinkComponent addComponent(const ConstSinkComponentClass componentClass, const bt2c::CStringView name, const OptionalBorrowedObject params = {}, - const LoggingLevel loggingLevel = LoggingLevel::NONE) const + const LoggingLevel loggingLevel = LoggingLevel::None) const { return this->_addComponent( componentClass, name, params, static_cast(nullptr), loggingLevel, @@ -110,7 +110,7 @@ public: ConstSinkComponent addComponent(const ConstSinkComponentClass componentClass, const bt2c::CStringView name, InitDataT&& initData, const OptionalBorrowedObject params = {}, - const LoggingLevel loggingLevel = LoggingLevel::NONE) const + const LoggingLevel loggingLevel = LoggingLevel::None) const { return this->_addComponent( componentClass, name, params, &initData, loggingLevel, diff --git a/src/cpp-common/bt2/logging.hpp b/src/cpp-common/bt2/logging.hpp index 10e1ee3a..d8c8a480 100644 --- a/src/cpp-common/bt2/logging.hpp +++ b/src/cpp-common/bt2/logging.hpp @@ -9,19 +9,27 @@ #include +#include "common/macros.h" + namespace bt2 { +/* Avoid `-Wshadow` error on GCC, conflicting with `bt2::Error` */ +BT_DIAG_PUSH +BT_DIAG_IGNORE_SHADOW + enum class LoggingLevel { - TRACE = BT_LOGGING_LEVEL_TRACE, - DEBUG = BT_LOGGING_LEVEL_DEBUG, - INFO = BT_LOGGING_LEVEL_INFO, - WARNING = BT_LOGGING_LEVEL_WARNING, - ERROR = BT_LOGGING_LEVEL_ERROR, - FATAL = BT_LOGGING_LEVEL_FATAL, - NONE = BT_LOGGING_LEVEL_NONE, + Trace = BT_LOGGING_LEVEL_TRACE, + Debug = BT_LOGGING_LEVEL_DEBUG, + Info = BT_LOGGING_LEVEL_INFO, + Warning = BT_LOGGING_LEVEL_WARNING, + Error = BT_LOGGING_LEVEL_ERROR, + Fatal = BT_LOGGING_LEVEL_FATAL, + None = BT_LOGGING_LEVEL_NONE, }; +BT_DIAG_POP + } /* namespace bt2 */ #endif /* BABELTRACE_CPP_COMMON_BT2_LOGGING_HPP */ diff --git a/src/cpp-common/bt2/message.hpp b/src/cpp-common/bt2/message.hpp index be9be118..93f8acd6 100644 --- a/src/cpp-common/bt2/message.hpp +++ b/src/cpp-common/bt2/message.hpp @@ -70,14 +70,14 @@ class CommonMessageIteratorInactivityMessage; enum class MessageType { - STREAM_BEGINNING = BT_MESSAGE_TYPE_STREAM_BEGINNING, - STREAM_END = BT_MESSAGE_TYPE_STREAM_END, - EVENT = BT_MESSAGE_TYPE_EVENT, - PACKET_BEGINNING = BT_MESSAGE_TYPE_PACKET_BEGINNING, - PACKET_END = BT_MESSAGE_TYPE_PACKET_END, - DISCARDED_EVENTS = BT_MESSAGE_TYPE_DISCARDED_EVENTS, - DISCARDED_PACKETS = BT_MESSAGE_TYPE_DISCARDED_PACKETS, - MESSAGE_ITERATOR_INACTIVITY = BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY, + StreamBeginning = BT_MESSAGE_TYPE_STREAM_BEGINNING, + StreamEnd = BT_MESSAGE_TYPE_STREAM_END, + Event = BT_MESSAGE_TYPE_EVENT, + PacketBeginning = BT_MESSAGE_TYPE_PACKET_BEGINNING, + PacketEnd = BT_MESSAGE_TYPE_PACKET_END, + DiscardedEvents = BT_MESSAGE_TYPE_DISCARDED_EVENTS, + DiscardedPackets = BT_MESSAGE_TYPE_DISCARDED_PACKETS, + MessageIteratorInactivity = BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY, }; template @@ -121,42 +121,42 @@ public: bool isStreamBeginning() const noexcept { - return this->type() == MessageType::STREAM_BEGINNING; + return this->type() == MessageType::StreamBeginning; } bool isStreamEnd() const noexcept { - return this->type() == MessageType::STREAM_END; + return this->type() == MessageType::StreamEnd; } bool isEvent() const noexcept { - return this->type() == MessageType::EVENT; + return this->type() == MessageType::Event; } bool isPacketBeginning() const noexcept { - return this->type() == MessageType::PACKET_BEGINNING; + return this->type() == MessageType::PacketBeginning; } bool isPacketEnd() const noexcept { - return this->type() == MessageType::PACKET_END; + return this->type() == MessageType::PacketEnd; } bool isDiscardedEvents() const noexcept { - return this->type() == MessageType::DISCARDED_EVENTS; + return this->type() == MessageType::DiscardedEvents; } bool isDiscardedPackets() const noexcept { - return this->type() == MessageType::DISCARDED_PACKETS; + return this->type() == MessageType::DiscardedPackets; } bool isMessageIteratorInactivity() const noexcept { - return this->type() == MessageType::MESSAGE_ITERATOR_INACTIVITY; + return this->type() == MessageType::MessageIteratorInactivity; } Shared shared() const noexcept diff --git a/src/cpp-common/bt2/trace-ir.hpp b/src/cpp-common/bt2/trace-ir.hpp index f2678f89..18124b87 100644 --- a/src/cpp-common/bt2/trace-ir.hpp +++ b/src/cpp-common/bt2/trace-ir.hpp @@ -12,6 +12,7 @@ #include +#include "common/macros.h" #include "cpp-common/bt2c/c-string-view.hpp" #include "cpp-common/bt2s/optional.hpp" @@ -870,25 +871,31 @@ public: using Shared = SharedObject; using UserAttributes = internal::DepUserAttrs; + /* Avoid `-Wshadow` error on GCC, conflicting with `bt2::Error` */ + BT_DIAG_PUSH + BT_DIAG_IGNORE_SHADOW + enum class LogLevel { - EMERGENCY = BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY, - ALERT = BT_EVENT_CLASS_LOG_LEVEL_ALERT, - CRITICAL = BT_EVENT_CLASS_LOG_LEVEL_CRITICAL, - ERR = BT_EVENT_CLASS_LOG_LEVEL_ERROR, - WARNING = BT_EVENT_CLASS_LOG_LEVEL_WARNING, - NOTICE = BT_EVENT_CLASS_LOG_LEVEL_NOTICE, - INFO = BT_EVENT_CLASS_LOG_LEVEL_INFO, - DEBUG_SYSTEM = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM, - DEBUG_PROGRAM = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM, - DEBUG_PROC = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS, - DEBUG_MODULE = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE, - DEBUG_UNIT = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT, - DEBUG_FUNCTION = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION, - DEBUG_LINE = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE, - DEBUG = BT_EVENT_CLASS_LOG_LEVEL_DEBUG, + Emergency = BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY, + Alert = BT_EVENT_CLASS_LOG_LEVEL_ALERT, + Critical = BT_EVENT_CLASS_LOG_LEVEL_CRITICAL, + Error = BT_EVENT_CLASS_LOG_LEVEL_ERROR, + Warning = BT_EVENT_CLASS_LOG_LEVEL_WARNING, + Notice = BT_EVENT_CLASS_LOG_LEVEL_NOTICE, + Info = BT_EVENT_CLASS_LOG_LEVEL_INFO, + DebugSystem = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM, + DebugProgram = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM, + DebugProcess = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS, + DebugModule = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE, + DebugUnit = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT, + DebugFunction = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION, + DebugLine = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE, + Debug = BT_EVENT_CLASS_LOG_LEVEL_DEBUG, }; + BT_DIAG_POP + explicit CommonEventClass(const LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } diff --git a/src/cpp-common/bt2/value.hpp b/src/cpp-common/bt2/value.hpp index 80e17dea..b5870ca3 100644 --- a/src/cpp-common/bt2/value.hpp +++ b/src/cpp-common/bt2/value.hpp @@ -72,14 +72,14 @@ class CommonMapValue; enum class ValueType { - NUL = BT_VALUE_TYPE_NULL, - BOOL = BT_VALUE_TYPE_BOOL, - UNSIGNED_INTEGER = BT_VALUE_TYPE_UNSIGNED_INTEGER, - SIGNED_INTEGER = BT_VALUE_TYPE_SIGNED_INTEGER, - REAL = BT_VALUE_TYPE_REAL, - STRING = BT_VALUE_TYPE_STRING, - ARRAY = BT_VALUE_TYPE_ARRAY, - MAP = BT_VALUE_TYPE_MAP, + Null = BT_VALUE_TYPE_NULL, + Bool = BT_VALUE_TYPE_BOOL, + UnsignedInteger = BT_VALUE_TYPE_UNSIGNED_INTEGER, + SignedInteger = BT_VALUE_TYPE_SIGNED_INTEGER, + Real = BT_VALUE_TYPE_REAL, + String = BT_VALUE_TYPE_STRING, + Array = BT_VALUE_TYPE_ARRAY, + Map = BT_VALUE_TYPE_MAP, }; template diff --git a/src/cpp-common/bt2c/logging.hpp b/src/cpp-common/bt2c/logging.hpp index c36e19b7..0d3e36e7 100644 --- a/src/cpp-common/bt2c/logging.hpp +++ b/src/cpp-common/bt2c/logging.hpp @@ -47,13 +47,13 @@ public: /* Available log levels */ enum class Level { - TRACE = BT_LOG_TRACE, - DEBUG = BT_LOG_DEBUG, - INFO = BT_LOG_INFO, - WARNING = BT_LOG_WARNING, - ERROR = BT_LOG_ERROR, - FATAL = BT_LOG_FATAL, - NONE = BT_LOG_NONE, + Trace = BT_LOG_TRACE, + Debug = BT_LOG_DEBUG, + Info = BT_LOG_INFO, + Warning = BT_LOG_WARNING, + Error = BT_LOG_ERROR, + Fatal = BT_LOG_FATAL, + None = BT_LOG_NONE, }; /* @@ -171,7 +171,7 @@ public: */ bool wouldLogT() const noexcept { - return this->wouldLog(Level::TRACE); + return this->wouldLog(Level::Trace); } /* @@ -179,7 +179,7 @@ public: */ bool wouldLogD() const noexcept { - return this->wouldLog(Level::DEBUG); + return this->wouldLog(Level::Debug); } /* @@ -187,7 +187,7 @@ public: */ bool wouldLogI() const noexcept { - return this->wouldLog(Level::INFO); + return this->wouldLog(Level::Info); } /* @@ -195,7 +195,7 @@ public: */ bool wouldLogW() const noexcept { - return this->wouldLog(Level::WARNING); + return this->wouldLog(Level::Warning); } /* @@ -203,7 +203,7 @@ public: */ bool wouldLogE() const noexcept { - return this->wouldLog(Level::ERROR); + return this->wouldLog(Level::Error); } /* @@ -211,7 +211,7 @@ public: */ bool wouldLogF() const noexcept { - return this->wouldLog(Level::FATAL); + return this->wouldLog(Level::Fatal); } /* @@ -300,7 +300,7 @@ public: } /* - * Like logAndNoThrow() with the `Level::ERROR` level, but also + * Like logAndNoThrow() with the `Level::Error` level, but also * throws a default-constructed instance of `ExcT`. */ template @@ -308,25 +308,25 @@ public: const unsigned int lineNo, const char * const fmt, ArgTs&&...args) const { - this->logNoThrow(fileName, funcName, lineNo, fmt, + this->logNoThrow(fileName, funcName, lineNo, fmt, std::forward(args)...); throw ExcT {}; } /* - * Like logStrAndNoThrow() with the `Level::ERROR` level, but also + * Like logStrAndNoThrow() with the `Level::Error` level, but also * throws a default-constructed instance of `ExcT`. */ template [[noreturn]] void logErrorStrAndThrow(const char * const fileName, const char * const funcName, const unsigned int lineNo, const char * const msg) const { - this->logStrNoThrow(fileName, funcName, lineNo, msg); + this->logStrNoThrow(fileName, funcName, lineNo, msg); throw ExcT {}; } /* - * Like logAndNoThrow() with the `Level::ERROR` level, but also + * Like logAndNoThrow() with the `Level::Error` level, but also * rethrows. */ template @@ -334,13 +334,13 @@ public: const unsigned int lineNo, const char * const fmt, ArgTs&&...args) const { - this->logNoThrow(fileName, funcName, lineNo, fmt, + this->logNoThrow(fileName, funcName, lineNo, fmt, std::forward(args)...); throw; } /* - * Like logStrAndNoThrow() with the `Level::ERROR` level, but also + * Like logStrAndNoThrow() with the `Level::Error` level, but also * rethrows. */ template @@ -348,7 +348,7 @@ public: const char * const funcName, const unsigned int lineNo, const char * const msg) const { - this->logStrNoThrow(fileName, funcName, lineNo, msg); + this->logStrNoThrow(fileName, funcName, lineNo, msg); throw; } @@ -405,7 +405,7 @@ public: } /* - * Like logErrnoNoThrow() with the `Level::ERROR` level, but also + * Like logErrnoNoThrow() with the `Level::Error` level, but also * throws a default-constructed instance of `ExcT`. */ template @@ -414,13 +414,13 @@ public: const char * const initMsg, const char * const fmt, ArgTs&&...args) const { - this->logErrnoNoThrow(fileName, funcName, lineNo, initMsg, fmt, + this->logErrnoNoThrow(fileName, funcName, lineNo, initMsg, fmt, std::forward(args)...); throw ExcT {}; } /* - * Like logErrnoStrNoThrow() with the `Level::ERROR` level, but also + * Like logErrnoStrNoThrow() with the `Level::Error` level, but also * throws a default-constructed instance of `ExcT`. */ template @@ -429,13 +429,13 @@ public: const unsigned int lineNo, const char * const initMsg, const char * const msg) const { - this->logErrnoStrNoThrow(fileName, funcName, lineNo, initMsg, + this->logErrnoStrNoThrow(fileName, funcName, lineNo, initMsg, msg); throw ExcT {}; } /* - * Like logErrnoNoThrow() with the `Level::ERROR` level, but also + * Like logErrnoNoThrow() with the `Level::Error` level, but also * rethrows. */ template @@ -444,13 +444,13 @@ public: const unsigned int lineNo, const char * const initMsg, const char * const fmt, ArgTs&&...args) const { - this->logErrnoNoThrow(fileName, funcName, lineNo, initMsg, fmt, + this->logErrnoNoThrow(fileName, funcName, lineNo, initMsg, fmt, std::forward(args)...); throw; } /* - * Like logErrnoStrNoThrow() with the `Level::ERROR` level, but also + * Like logErrnoStrNoThrow() with the `Level::Error` level, but also * rethrows. */ template @@ -459,7 +459,7 @@ public: const unsigned int lineNo, const char * const initMsg, const char * const msg) const { - this->logErrnoStrNoThrow(fileName, funcName, lineNo, initMsg, + this->logErrnoStrNoThrow(fileName, funcName, lineNo, initMsg, msg); throw; } @@ -618,17 +618,17 @@ private: * BT_CPPLOG_EX() with specific logging levels. */ #define BT_CPPLOGT_SPEC(_logger, _fmt, ...) \ - BT_CPPLOG_EX(bt2c::Logger::Level::TRACE, (_logger), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_EX(bt2c::Logger::Level::Trace, (_logger), (_fmt), ##__VA_ARGS__) #define BT_CPPLOGD_SPEC(_logger, _fmt, ...) \ - BT_CPPLOG_EX(bt2c::Logger::Level::DEBUG, (_logger), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_EX(bt2c::Logger::Level::Debug, (_logger), (_fmt), ##__VA_ARGS__) #define BT_CPPLOGI_SPEC(_logger, _fmt, ...) \ - BT_CPPLOG_EX(bt2c::Logger::Level::INFO, (_logger), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_EX(bt2c::Logger::Level::Info, (_logger), (_fmt), ##__VA_ARGS__) #define BT_CPPLOGW_SPEC(_logger, _fmt, ...) \ - BT_CPPLOG_EX(bt2c::Logger::Level::WARNING, (_logger), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_EX(bt2c::Logger::Level::Warning, (_logger), (_fmt), ##__VA_ARGS__) #define BT_CPPLOGE_SPEC(_logger, _fmt, ...) \ - BT_CPPLOG_EX(bt2c::Logger::Level::ERROR, (_logger), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_EX(bt2c::Logger::Level::Error, (_logger), (_fmt), ##__VA_ARGS__) #define BT_CPPLOGF_SPEC(_logger, _fmt, ...) \ - BT_CPPLOG_EX(bt2c::Logger::Level::FATAL, (_logger), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_EX(bt2c::Logger::Level::Fatal, (_logger), (_fmt), ##__VA_ARGS__) /* * BT_CPPLOG_EX() with specific logging levels and using the default @@ -652,17 +652,17 @@ private: * BT_CPPLOG_STR_EX() with specific logging levels. */ #define BT_CPPLOGT_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::TRACE, (_logger), (_msg)) + BT_CPPLOG_STR_EX(bt2c::Logger::Level::Trace, (_logger), (_msg)) #define BT_CPPLOGD_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::DEBUG, (_logger), (_msg)) + BT_CPPLOG_STR_EX(bt2c::Logger::Level::Debug, (_logger), (_msg)) #define BT_CPPLOGI_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::INFO, (_logger), (_msg)) + BT_CPPLOG_STR_EX(bt2c::Logger::Level::Info, (_logger), (_msg)) #define BT_CPPLOGW_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::WARNING, (_logger), (_msg)) + BT_CPPLOG_STR_EX(bt2c::Logger::Level::Warning, (_logger), (_msg)) #define BT_CPPLOGE_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::ERROR, (_logger), (_msg)) + BT_CPPLOG_STR_EX(bt2c::Logger::Level::Error, (_logger), (_msg)) #define BT_CPPLOGF_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::FATAL, (_logger), (_msg)) + BT_CPPLOG_STR_EX(bt2c::Logger::Level::Fatal, (_logger), (_msg)) /* * BT_CPPLOG_STR_EX() with specific logging levels and using the default @@ -691,22 +691,22 @@ private: * BT_CPPLOG_MEM_EX() with specific logging levels. */ #define BT_CPPLOGT_MEM_SPEC(_logger, _mem_data, _mem_len, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::TRACE, (_logger), (_mem_data), (_mem_len), (_fmt), \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Trace, (_logger), (_mem_data), (_mem_len), (_fmt), \ ##__VA_ARGS__) #define BT_CPPLOGD_MEM_SPEC(_logger, _mem_data, _mem_len, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::DEBUG, (_logger), (_mem_data), (_mem_len), (_fmt), \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Debug, (_logger), (_mem_data), (_mem_len), (_fmt), \ ##__VA_ARGS__) #define BT_CPPLOGI_MEM_SPEC(_logger, _mem_data, _mem_len, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::INFO, (_logger), (_mem_data), (_mem_len), (_fmt), \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Info, (_logger), (_mem_data), (_mem_len), (_fmt), \ ##__VA_ARGS__) #define BT_CPPLOGW_MEM_SPEC(_logger, _mem_data, _mem_len, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::WARNING, (_logger), (_mem_data), (_mem_len), (_fmt), \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Warning, (_logger), (_mem_data), (_mem_len), (_fmt), \ ##__VA_ARGS__) #define BT_CPPLOGE_MEM_SPEC(_logger, _mem_data, _mem_len, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::ERROR, (_logger), (_mem_data), (_mem_len), (_fmt), \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Error, (_logger), (_mem_data), (_mem_len), (_fmt), \ ##__VA_ARGS__) #define BT_CPPLOGF_MEM_SPEC(_logger, _mem_data, _mem_len, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::FATAL, (_logger), (_mem_data), (_mem_len), (_fmt), \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Fatal, (_logger), (_mem_data), (_mem_len), (_fmt), \ ##__VA_ARGS__) /* @@ -746,7 +746,7 @@ private: #define BT_CPPLOGW_MEM_STR_SPEC(_logger, _mem_data, _mem_len, _msg) \ BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::WARNING, (_logger), (_mem_data), (_mem_len), (_msg)) #define BT_CPPLOGE_MEM_STR_SPEC(_logger, _mem_data, _mem_len, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::ERROR, (_logger), (_mem_data), (_mem_len), (_msg)) + BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::Error, (_logger), (_mem_data), (_mem_len), (_msg)) #define BT_CPPLOGF_MEM_STR_SPEC(_logger, _mem_data, _mem_len, _msg) \ BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::FATAL, (_logger), (_mem_data), (_mem_len), (_msg)) @@ -783,17 +783,17 @@ private: * BT_CPPLOG_ERRNO_EX() with specific logging levels. */ #define BT_CPPLOGT_ERRNO_SPEC(_logger, _init_msg, _fmt, ...) \ - BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::TRACE, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::Trace, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) #define BT_CPPLOGD_ERRNO_SPEC(_logger, _init_msg, _fmt, ...) \ - BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::DEBUG, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::Debug, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) #define BT_CPPLOGI_ERRNO_SPEC(_logger, _init_msg, _fmt, ...) \ - BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::INFO, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::Info, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) #define BT_CPPLOGW_ERRNO_SPEC(_logger, _init_msg, _fmt, ...) \ - BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::WARNING, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::Warning, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) #define BT_CPPLOGE_ERRNO_SPEC(_logger, _init_msg, _fmt, ...) \ - BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::ERROR, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::Error, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) #define BT_CPPLOGF_ERRNO_SPEC(_logger, _init_msg, _fmt, ...) \ - BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::FATAL, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) + BT_CPPLOG_ERRNO_EX(bt2c::Logger::Level::Fatal, (_logger), (_init_msg), (_fmt), ##__VA_ARGS__) /* * BT_CPPLOG_ERRNO_EX() with specific logging levels and using the @@ -823,17 +823,17 @@ private: * BT_CPPLOG_ERRNO_STR_EX() with specific logging levels. */ #define BT_CPPLOGT_ERRNO_STR_SPEC(_logger, _init_msg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::TRACE, (_logger), (_init_msg), (_msg)) + BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Trace, (_logger), (_init_msg), (_msg)) #define BT_CPPLOGD_ERRNO_STR_SPEC(_logger, _init_msg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::DEBUG, (_logger), (_init_msg), (_msg)) + BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Debug, (_logger), (_init_msg), (_msg)) #define BT_CPPLOGI_ERRNO_STR_SPEC(_logger, _init_msg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::INFO, (_logger), (_init_msg), (_msg)) + BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Info, (_logger), (_init_msg), (_msg)) #define BT_CPPLOGW_ERRNO_STR_SPEC(_logger, _init_msg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::WARNING, (_logger), (_init_msg), (_msg)) + BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Warning, (_logger), (_init_msg), (_msg)) #define BT_CPPLOGE_ERRNO_STR_SPEC(_logger, _init_msg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::ERROR, (_logger), (_init_msg), (_msg)) + BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Error, (_logger), (_init_msg), (_msg)) #define BT_CPPLOGF_ERRNO_STR_SPEC(_logger, _init_msg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::FATAL, (_logger), (_init_msg), (_msg)) + BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Fatal, (_logger), (_init_msg), (_msg)) /* * BT_CPPLOG_ERRNO_STR_EX() with specific logging levels and using the diff --git a/src/plugins/utils/muxer/msg-iter.cpp b/src/plugins/utils/muxer/msg-iter.cpp index b1d86945..c3e8c3db 100644 --- a/src/plugins/utils/muxer/msg-iter.cpp +++ b/src/plugins/utils/muxer/msg-iter.cpp @@ -125,7 +125,7 @@ void MsgIter::_next(bt2::ConstMessageArray& msgs) oldestUpstreamMsgIter.portName()); try { - if (G_LIKELY(oldestUpstreamMsgIter.reload() == UpstreamMsgIter::ReloadStatus::MORE)) { + if (G_LIKELY(oldestUpstreamMsgIter.reload() == UpstreamMsgIter::ReloadStatus::More)) { /* New current message: update heap */ _mHeap.replaceTop(&oldestUpstreamMsgIter); BT_CPPLOGD("More messages available; updated heap: port-name={}, heap-len={}", @@ -166,7 +166,7 @@ void MsgIter::_ensureFullHeap() "port-name={}, heap-len={}, to-reload-len={}", upstreamMsgIter.portName(), _mHeap.len(), _mUpstreamMsgItersToReload.size()); - if (G_LIKELY(upstreamMsgIter.reload() == UpstreamMsgIter::ReloadStatus::MORE)) { + if (G_LIKELY(upstreamMsgIter.reload() == UpstreamMsgIter::ReloadStatus::More)) { /* New current message: move to heap */ _mHeap.insert(&upstreamMsgIter); BT_CPPLOGD("More messages available; " @@ -253,16 +253,16 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg) const auto actualClockCls = error.actualClockCls(); switch (error.type()) { - case Type::EXPECTING_NO_CLOCK_CLASS_GOT_ONE: + case Type::ExpectingNoClockClassGotOne: BT_CPPLOGE_APPEND_CAUSE_AND_THROW(bt2::Error, "Expecting no clock class, but got one: " "clock-class-addr={}, clock-class-name={}", fmt::ptr(actualClockCls->libObjPtr()), actualClockCls->name()); - case Type::EXPECTING_ORIGIN_UNIX_GOT_NONE: - case Type::EXPECTING_ORIGIN_UUID_GOT_NONE: - case Type::EXPECTING_ORIGIN_NO_UUID_GOT_NONE: + case Type::ExpectingOriginUnixGotNone: + case Type::ExpectingOriginUuidGotNone: + case Type::ExpectingOriginNoUuidGotNone: { const auto streamCls = *error.streamCls(); @@ -274,7 +274,7 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg) streamCls.id()); } - case Type::EXPECTING_ORIGIN_UNIX_GOT_OTHER: + case Type::ExpectingOriginUnixGotOther: BT_CPPLOGE_APPEND_CAUSE_AND_THROW(bt2::Error, "Expecting a clock class having a Unix epoch origin, " "but got one not having a Unix epoch origin: " @@ -282,7 +282,7 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg) fmt::ptr(actualClockCls->libObjPtr()), actualClockCls->name()); - case Type::EXPECTING_ORIGIN_UUID_GOT_UNIX: + case Type::ExpectingOriginUuidGotUnix: BT_CPPLOGE_APPEND_CAUSE_AND_THROW( bt2::Error, "Expecting a clock class not having a Unix epoch origin, " @@ -290,14 +290,14 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg) "clock-class-addr={}, clock-class-name={}", fmt::ptr(actualClockCls->libObjPtr()), actualClockCls->name()); - case Type::EXPECTING_ORIGIN_UUID_GOT_NO_UUID: + case Type::ExpectingOriginUuidGotNoUuid: BT_CPPLOGE_APPEND_CAUSE_AND_THROW( bt2::Error, "Expecting a clock class with a UUID, but got one without a UUID: " "clock-class-addr={}, clock-class-name={}", fmt::ptr(actualClockCls->libObjPtr()), actualClockCls->name()); - case Type::EXPECTING_ORIGIN_UUID_GOT_OTHER_UUID: + case Type::ExpectingOriginUuidGotOtherUuid: BT_CPPLOGE_APPEND_CAUSE_AND_THROW(bt2::Error, "Expecting a clock class with a specific UUID, " "but got one with a different UUID: " @@ -307,7 +307,7 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg) actualClockCls->name(), *error.expectedUuid(), *actualClockCls->uuid()); - case Type::EXPECTING_ORIGIN_NO_UUID_GOT_OTHER: + case Type::ExpectingOriginNoUuidGotOther: { const auto expectedClockCls = error.expectedClockCls(); diff --git a/src/plugins/utils/muxer/upstream-msg-iter.cpp b/src/plugins/utils/muxer/upstream-msg-iter.cpp index 28f5be47..ea597da2 100644 --- a/src/plugins/utils/muxer/upstream-msg-iter.cpp +++ b/src/plugins/utils/muxer/upstream-msg-iter.cpp @@ -33,45 +33,45 @@ namespace { bt2::OptionalBorrowedObject msgCs(const bt2::ConstMessage msg) noexcept { switch (msg.type()) { - case bt2::MessageType::EVENT: + case bt2::MessageType::Event: if (msg.asEvent().streamClassDefaultClockClass()) { return msg.asEvent().defaultClockSnapshot(); } break; - case bt2::MessageType::PACKET_BEGINNING: + case bt2::MessageType::PacketBeginning: if (msg.asPacketBeginning().packet().stream().cls().packetsHaveBeginningClockSnapshot()) { return msg.asPacketBeginning().defaultClockSnapshot(); } break; - case bt2::MessageType::PACKET_END: + case bt2::MessageType::PacketEnd: if (msg.asPacketEnd().packet().stream().cls().packetsHaveEndClockSnapshot()) { return msg.asPacketEnd().defaultClockSnapshot(); } break; - case bt2::MessageType::DISCARDED_EVENTS: + case bt2::MessageType::DiscardedEvents: if (msg.asDiscardedEvents().stream().cls().discardedEventsHaveDefaultClockSnapshots()) { return msg.asDiscardedEvents().beginningDefaultClockSnapshot(); } break; - case bt2::MessageType::DISCARDED_PACKETS: + case bt2::MessageType::DiscardedPackets: if (msg.asDiscardedPackets().stream().cls().discardedPacketsHaveDefaultClockSnapshots()) { return msg.asDiscardedPackets().beginningDefaultClockSnapshot(); } break; - case bt2::MessageType::MESSAGE_ITERATOR_INACTIVITY: + case bt2::MessageType::MessageIteratorInactivity: return msg.asMessageIteratorInactivity().clockSnapshot(); - case bt2::MessageType::STREAM_BEGINNING: + case bt2::MessageType::StreamBeginning: if (msg.asStreamBeginning().streamClassDefaultClockClass()) { return msg.asStreamBeginning().defaultClockSnapshot(); } break; - case bt2::MessageType::STREAM_END: + case bt2::MessageType::StreamEnd: if (msg.asStreamEnd().streamClassDefaultClockClass()) { return msg.asStreamEnd().defaultClockSnapshot(); } @@ -108,7 +108,7 @@ UpstreamMsgIter::ReloadStatus UpstreamMsgIter::reload() if (G_UNLIKELY(!_mMsgs.msgs)) { /* Still none: no more */ _mMsgTs.reset(); - return ReloadStatus::NO_MORE; + return ReloadStatus::NoMore; } else { if (const auto cs = msgCs(this->msg())) { _mMsgTs = cs->nsFromOrigin(); @@ -120,7 +120,7 @@ UpstreamMsgIter::ReloadStatus UpstreamMsgIter::reload() } _mDiscardRequired = true; - return ReloadStatus::MORE; + return ReloadStatus::More; } } diff --git a/src/plugins/utils/muxer/upstream-msg-iter.hpp b/src/plugins/utils/muxer/upstream-msg-iter.hpp index 2ae663f8..4d89da39 100644 --- a/src/plugins/utils/muxer/upstream-msg-iter.hpp +++ b/src/plugins/utils/muxer/upstream-msg-iter.hpp @@ -33,8 +33,8 @@ public: /* Return type of reload() */ enum class ReloadStatus { - MORE, - NO_MORE, + More, + NoMore, }; /* diff --git a/tests/lib/conds/clk-cls-compat-postconds-triggers.cpp b/tests/lib/conds/clk-cls-compat-postconds-triggers.cpp index a8a4d626..aa7e6876 100644 --- a/tests/lib/conds/clk-cls-compat-postconds-triggers.cpp +++ b/tests/lib/conds/clk-cls-compat-postconds-triggers.cpp @@ -21,8 +21,8 @@ class ClockClsCompatRunIn final : public RunIn public: enum class MsgType { - STREAM_BEG, - MSG_ITER_INACTIVITY, + StreamBeg, + MsgIterInactivity, }; using CreateClockCls = bt2::ClockClass::Shared (*)(bt2::SelfComponent); @@ -58,7 +58,7 @@ private: const auto clockCls = createClockCls(self.component()); switch (msgType) { - case MsgType::STREAM_BEG: + case MsgType::StreamBeg: { const auto streamCls = trace.cls().createStreamClass(); @@ -69,7 +69,7 @@ private: return self.createStreamBeginningMessage(*streamCls->instantiate(trace)); } - case MsgType::MSG_ITER_INACTIVITY: + case MsgType::MsgIterInactivity: BT_ASSERT(clockCls); return self.createMessageIteratorInactivityMessage(*clockCls, 12); }; @@ -85,10 +85,10 @@ private: __attribute__((used)) const char *format_as(const ClockClsCompatRunIn::MsgType msgType) { switch (msgType) { - case ClockClsCompatRunIn::MsgType::STREAM_BEG: + case ClockClsCompatRunIn::MsgType::StreamBeg: return "sb"; - case ClockClsCompatRunIn::MsgType::MSG_ITER_INACTIVITY: + case ClockClsCompatRunIn::MsgType::MsgIterInactivity: return "mii"; } @@ -124,13 +124,13 @@ void addClkClsCompatTriggers(CondTriggers& triggers) * without a clock class. */ static constexpr std::array msgTypes { - ClockClsCompatRunIn::MsgType::STREAM_BEG, - ClockClsCompatRunIn::MsgType::MSG_ITER_INACTIVITY, + ClockClsCompatRunIn::MsgType::StreamBeg, + ClockClsCompatRunIn::MsgType::MsgIterInactivity, }; const auto isInvalidCase = [](const ClockClsCompatRunIn::MsgType msgType, const ClockClsCompatRunIn::CreateClockCls createClockCls) { - return msgType == ClockClsCompatRunIn::MsgType::MSG_ITER_INACTIVITY && + return msgType == ClockClsCompatRunIn::MsgType::MsgIterInactivity && createClockCls == noClockClass; }; @@ -146,7 +146,7 @@ void addClkClsCompatTriggers(CondTriggers& triggers) triggers.emplace_back(bt2s::make_unique>( ClockClsCompatRunIn {msgType1, createClockCls1, msgType2, createClockCls2}, - CondTrigger::Type::POST, condId, fmt::format("{}-{}", msgType1, msgType2))); + CondTrigger::Type::Post, condId, fmt::format("{}-{}", msgType1, msgType2))); } } }; diff --git a/tests/lib/conds/conds-triggers.cpp b/tests/lib/conds/conds-triggers.cpp index 3e1cfe86..1c174c01 100644 --- a/tests/lib/conds/conds-triggers.cpp +++ b/tests/lib/conds/conds-triggers.cpp @@ -88,25 +88,25 @@ int main(const int argc, const char ** const argv) [] { bt2::Graph::create(292); }, - CondTrigger::Type::PRE, "graph-create:valid-mip-version")); + CondTrigger::Type::Pre, "graph-create:valid-mip-version")); triggers.emplace_back(makeRunInCompInitTrigger( [](const bt2::SelfComponent self) { createUIntFc(self)->fieldValueRange(0); }, - CondTrigger::Type::PRE, "field-class-integer-set-field-value-range:valid-n", "0")); + CondTrigger::Type::Pre, "field-class-integer-set-field-value-range:valid-n", "0")); triggers.emplace_back(makeRunInCompInitTrigger( [](const bt2::SelfComponent self) { createUIntFc(self)->fieldValueRange(65); }, - CondTrigger::Type::PRE, "field-class-integer-set-field-value-range:valid-n", "gt-64")); + CondTrigger::Type::Pre, "field-class-integer-set-field-value-range:valid-n", "gt-64")); triggers.emplace_back(makeSimpleTrigger( [] { bt_field_class_integer_set_field_value_range(nullptr, 23); }, - CondTrigger::Type::PRE, "field-class-integer-set-field-value-range:not-null:field-class")); + CondTrigger::Type::Pre, "field-class-integer-set-field-value-range:not-null:field-class")); addClkClsCompatTriggers(triggers); condMain(bt2c::makeSpan(argv, argc), triggers); diff --git a/tests/lib/conds/utils.cpp b/tests/lib/conds/utils.cpp index b7d2c487..4d4e3b1d 100644 --- a/tests/lib/conds/utils.cpp +++ b/tests/lib/conds/utils.cpp @@ -19,7 +19,7 @@ CondTrigger::CondTrigger(const Type type, const std::string& condId, const bt2c::CStringView nameSuffix) noexcept : _mType {type}, - _mCondId {fmt::format("{}:{}", type == Type::PRE ? "pre" : "post", condId)}, + _mCondId {fmt::format("{}:{}", type == Type::Pre ? "pre" : "post", condId)}, _mName {fmt::format("{}{}{}", condId, nameSuffix ? "-" : "", nameSuffix ? nameSuffix : "")} { } diff --git a/tests/lib/conds/utils.hpp b/tests/lib/conds/utils.hpp index d8abfafe..2ea53bc4 100644 --- a/tests/lib/conds/utils.hpp +++ b/tests/lib/conds/utils.hpp @@ -37,8 +37,8 @@ public: */ enum class Type { - PRE, - POST, + Pre, + Post, }; protected: diff --git a/tests/plugins/flt.utils.muxer/test-clock-compatibility.cpp b/tests/plugins/flt.utils.muxer/test-clock-compatibility.cpp index c922d8cc..ef05d1d5 100644 --- a/tests/plugins/flt.utils.muxer/test-clock-compatibility.cpp +++ b/tests/plugins/flt.utils.muxer/test-clock-compatibility.cpp @@ -20,19 +20,19 @@ namespace { enum class MsgType { /* Send stream beginning and stream end messages. */ - STREAM, + Stream, /* Send a message iterator inactivity message. */ - MSG_ITER_INACTIVITY, + MsgIterInactivity, }; __attribute__((used)) const char *format_as(MsgType msgType) noexcept { switch (msgType) { - case MsgType::STREAM: + case MsgType::Stream: return "stream beginning/end"; - case MsgType::MSG_ITER_INACTIVITY: + case MsgType::MsgIterInactivity: return "message iterator inactivity"; } @@ -78,7 +78,7 @@ private: const auto clockCls = _mData->createClockClass(_mSelf.component()); switch (_mData->msgType) { - case MsgType::STREAM: + case MsgType::Stream: { const auto traceCls = _mSelf.component().createTraceClass(); const auto streamCls = traceCls->createStreamClass(); @@ -113,7 +113,7 @@ private: break; } - case MsgType::MSG_ITER_INACTIVITY: + case MsgType::MsgIterInactivity: msgs.append( this->_createMessageIteratorInactivityMessage(*clockCls, *_mData->clockSnapshot)); break; @@ -180,8 +180,8 @@ bt2::ClockClass::Shared noClockClass(bt2::SelfComponent) noexcept void ErrorTestCase::run() const noexcept { static constexpr std::array msgTypes { - MsgType::STREAM, - MsgType::MSG_ITER_INACTIVITY, + MsgType::Stream, + MsgType::MsgIterInactivity, }; for (const auto msgType1 : msgTypes) { @@ -190,8 +190,8 @@ void ErrorTestCase::run() const noexcept * It's not possible to create message iterator inactivity * messages without a clock class. Skip those cases. */ - if ((msgType1 == MsgType::MSG_ITER_INACTIVITY && _mCreateClockClass1 == noClockClass) || - (msgType2 == MsgType::MSG_ITER_INACTIVITY && _mCreateClockClass2 == noClockClass)) { + if ((msgType1 == MsgType::MsgIterInactivity && _mCreateClockClass1 == noClockClass) || + (msgType2 == MsgType::MsgIterInactivity && _mCreateClockClass2 == noClockClass)) { continue; } @@ -219,7 +219,7 @@ void ErrorTestCase::run() const noexcept * * Skip those cases. */ - if (msgType1 == MsgType::MSG_ITER_INACTIVITY && _mCreateClockClass2 == noClockClass) { + if (msgType1 == MsgType::MsgIterInactivity && _mCreateClockClass2 == noClockClass) { continue; } @@ -255,7 +255,7 @@ void ErrorTestCase::_runOne(const MsgType msgType1, const MsgType msgType2) cons const auto srcComp1 = graph->addComponent(*srcCompCls, "source-1", TestSourceData {_mCreateClockClass1, msgType1, - msgType1 == MsgType::MSG_ITER_INACTIVITY ? + msgType1 == MsgType::MsgIterInactivity ? bt2s::optional {10} : bt2s::nullopt}); const auto srcComp2 = -- 2.34.1