Change naming convention for enum class enumerators
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 28 Mar 2024 18:55:27 +0000 (14:55 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Apr 2024 17:57:53 +0000 (13:57 -0400)
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<LibObjT>::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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12212
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
23 files changed:
CONTRIBUTING.adoc
src/clock-correlation-validator/clock-correlation-validator.cpp
src/clock-correlation-validator/clock-correlation-validator.hpp
src/common/macros.h
src/cpp-common/bt2/component-class-dev.hpp
src/cpp-common/bt2/component-class.hpp
src/cpp-common/bt2/error.hpp
src/cpp-common/bt2/field-class.hpp
src/cpp-common/bt2/field-path.hpp
src/cpp-common/bt2/graph.hpp
src/cpp-common/bt2/logging.hpp
src/cpp-common/bt2/message.hpp
src/cpp-common/bt2/trace-ir.hpp
src/cpp-common/bt2/value.hpp
src/cpp-common/bt2c/logging.hpp
src/plugins/utils/muxer/msg-iter.cpp
src/plugins/utils/muxer/upstream-msg-iter.cpp
src/plugins/utils/muxer/upstream-msg-iter.hpp
tests/lib/conds/clk-cls-compat-postconds-triggers.cpp
tests/lib/conds/conds-triggers.cpp
tests/lib/conds/utils.cpp
tests/lib/conds/utils.hpp
tests/plugins/flt.utils.muxer/test-clock-compatibility.cpp

index 431a16691418bed00a20c174d2982b394b605125..35f4923c964e8e0a2231474242940ba8349922b9 100644 (file)
@@ -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;
index a116c364ccdbd6af5ca17eed6fb853f9dcf20913..4bb1a725bcddf4a4c85d4f008e9585301bb200f5 100644 (file)
@@ -19,12 +19,12 @@ void ClockCorrelationValidator::_validate(const bt2::ConstMessage msg)
     bt2::OptionalBorrowedObject<bt2::ConstStreamClass> 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;
index 773c97cba00647d84db2e0e403fdfffed96b3fcb..314551c3cd7cee53cd4b749a5397ced606fb2d59 100644 (file)
@@ -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
index 13ba2d3628c1abf4b36239838be6e00146224da5..8120515c63fe5bbcd81672f8c7b4cf1df89d9ce8 100644 (file)
@@ -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 \
index b89ac6b24305fa95b6eda6339138acff04d317c4..e0d45d6b7e20f0347dbbba67c473ee60f2a504e0 100644 (file)
@@ -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
     {
index e32ba34ae6811be0558401ce3f3f05de0b91b057..3d30ad35f0f79ed758dae3a2a850bdd7e48dd5cd 100644 (file)
@@ -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 :
index 7daaaf6b4b17c41c05ac88c204ee80110a39075e..030ff239a9aaa2eeae88d6eeaedb82e3a121e14c 100644 (file)
@@ -30,10 +30,10 @@ class ConstErrorCause : public BorrowedObject<const bt_error_cause>
 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;
index 411cf6690a1798355b2bcc2341a5621f203acc01..83cd52157cc4af723e6bc895817a52204e193cee 100644 (file)
@@ -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<ConstBitArrayFieldClass> : 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 <typename LibObjT>
index fc087593b881ecbaef878ccdea4642c4c3884de4..d203245f9a6c8a154852581be2bb4c90cf668f27 100644 (file)
@@ -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<const bt_field_path_item>
@@ -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}
index 0927cd30a0f2483aa22363dcd835844b9239c2f5..e2bcf77ce5ced33692f25c807b3f5f60c619b808 100644 (file)
@@ -57,7 +57,7 @@ public:
     ConstSourceComponent addComponent(const ConstSourceComponentClass componentClass,
                                       const bt2c::CStringView name,
                                       const OptionalBorrowedObject<ConstMapValue> params = {},
-                                      const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                      const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstSourceComponent>(
             componentClass, name, params, static_cast<void *>(nullptr), loggingLevel,
@@ -68,7 +68,7 @@ public:
     ConstSourceComponent addComponent(const ConstSourceComponentClass componentClass,
                                       const bt2c::CStringView name, InitDataT&& initData,
                                       const OptionalBorrowedObject<ConstMapValue> params = {},
-                                      const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                      const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstSourceComponent>(
             componentClass, name, params, &initData, loggingLevel,
@@ -78,7 +78,7 @@ public:
     ConstFilterComponent addComponent(const ConstFilterComponentClass componentClass,
                                       const bt2c::CStringView name,
                                       const OptionalBorrowedObject<ConstMapValue> params = {},
-                                      const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                      const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstFilterComponent>(
             componentClass, name, params, static_cast<void *>(nullptr), loggingLevel,
@@ -89,7 +89,7 @@ public:
     ConstFilterComponent addComponent(const ConstFilterComponentClass componentClass,
                                       const bt2c::CStringView name, InitDataT&& initData,
                                       const OptionalBorrowedObject<ConstMapValue> params = {},
-                                      const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                      const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstFilterComponent>(
             componentClass, name, params, &initData, loggingLevel,
@@ -99,7 +99,7 @@ public:
     ConstSinkComponent addComponent(const ConstSinkComponentClass componentClass,
                                     const bt2c::CStringView name,
                                     const OptionalBorrowedObject<ConstMapValue> params = {},
-                                    const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                    const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstSinkComponent>(
             componentClass, name, params, static_cast<void *>(nullptr), loggingLevel,
@@ -110,7 +110,7 @@ public:
     ConstSinkComponent addComponent(const ConstSinkComponentClass componentClass,
                                     const bt2c::CStringView name, InitDataT&& initData,
                                     const OptionalBorrowedObject<ConstMapValue> params = {},
-                                    const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                    const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstSinkComponent>(
             componentClass, name, params, &initData, loggingLevel,
index 10e1ee3a9fe83c9b222fb87c20eaeb35e84563fe..d8c8a480b5751c18dd8035d090e51cb7a068d596 100644 (file)
@@ -9,19 +9,27 @@
 
 #include <babeltrace2/babeltrace.h>
 
+#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 */
index be9be1184587d23bc5f1c4e117d3e16b7803170c..93f8acd61ee311dfff485976007612b58b012418 100644 (file)
@@ -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 <typename LibObjT>
@@ -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
index f2678f89e95efedef5c6a0c24893989fffd40707..18124b876de58953400a13b765d4e914044ae4f0 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <babeltrace2/babeltrace.h>
 
+#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<CommonEventClass, LibObjT, internal::EventClassRefFuncs>;
     using UserAttributes = internal::DepUserAttrs<LibObjT>;
 
+    /* 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}
     {
     }
index 80e17dea2fda6ef2fa94925f98fe543ed9a83d72..b5870ca3851dbca51c6742ba6b04202ec366b08f 100644 (file)
@@ -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 <typename ValueObjT>
index c36e19b710d9d1863c4f367fe08b951a06446104..0d3e36e730af1542483dd9b3a21a1d849951b219 100644 (file)
@@ -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 <bool AppendCauseV, typename ExcT, typename... ArgTs>
@@ -308,25 +308,25 @@ public:
                                        const unsigned int lineNo, const char * const fmt,
                                        ArgTs&&...args) const
     {
-        this->logNoThrow<Level::ERROR, AppendCauseV>(fileName, funcName, lineNo, fmt,
+        this->logNoThrow<Level::Error, AppendCauseV>(fileName, funcName, lineNo, fmt,
                                                      std::forward<ArgTs>(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 <bool AppendCauseV, typename ExcT>
     [[noreturn]] void logErrorStrAndThrow(const char * const fileName, const char * const funcName,
                                           const unsigned int lineNo, const char * const msg) const
     {
-        this->logStrNoThrow<Level::ERROR, AppendCauseV>(fileName, funcName, lineNo, msg);
+        this->logStrNoThrow<Level::Error, AppendCauseV>(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 <bool AppendCauseV, typename... ArgTs>
@@ -334,13 +334,13 @@ public:
                                          const unsigned int lineNo, const char * const fmt,
                                          ArgTs&&...args) const
     {
-        this->logNoThrow<Level::ERROR, AppendCauseV>(fileName, funcName, lineNo, fmt,
+        this->logNoThrow<Level::Error, AppendCauseV>(fileName, funcName, lineNo, fmt,
                                                      std::forward<ArgTs>(args)...);
         throw;
     }
 
     /*
-     * Like logStrAndNoThrow() with the `Level::ERROR` level, but also
+     * Like logStrAndNoThrow() with the `Level::Error` level, but also
      * rethrows.
      */
     template <bool AppendCauseV>
@@ -348,7 +348,7 @@ public:
                                             const char * const funcName, const unsigned int lineNo,
                                             const char * const msg) const
     {
-        this->logStrNoThrow<Level::ERROR, AppendCauseV>(fileName, funcName, lineNo, msg);
+        this->logStrNoThrow<Level::Error, AppendCauseV>(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 <bool AppendCauseV, typename ExcT, typename... ArgTs>
@@ -414,13 +414,13 @@ public:
                                             const char * const initMsg, const char * const fmt,
                                             ArgTs&&...args) const
     {
-        this->logErrnoNoThrow<Level::ERROR, AppendCauseV>(fileName, funcName, lineNo, initMsg, fmt,
+        this->logErrnoNoThrow<Level::Error, AppendCauseV>(fileName, funcName, lineNo, initMsg, fmt,
                                                           std::forward<ArgTs>(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 <bool AppendCauseV, typename ExcT>
@@ -429,13 +429,13 @@ public:
                              const unsigned int lineNo, const char * const initMsg,
                              const char * const msg) const
     {
-        this->logErrnoStrNoThrow<Level::ERROR, AppendCauseV>(fileName, funcName, lineNo, initMsg,
+        this->logErrnoStrNoThrow<Level::Error, AppendCauseV>(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 <bool AppendCauseV, typename... ArgTs>
@@ -444,13 +444,13 @@ public:
                                               const unsigned int lineNo, const char * const initMsg,
                                               const char * const fmt, ArgTs&&...args) const
     {
-        this->logErrnoNoThrow<Level::ERROR, AppendCauseV>(fileName, funcName, lineNo, initMsg, fmt,
+        this->logErrnoNoThrow<Level::Error, AppendCauseV>(fileName, funcName, lineNo, initMsg, fmt,
                                                           std::forward<ArgTs>(args)...);
         throw;
     }
 
     /*
-     * Like logErrnoStrNoThrow() with the `Level::ERROR` level, but also
+     * Like logErrnoStrNoThrow() with the `Level::Error` level, but also
      * rethrows.
      */
     template <bool AppendCauseV>
@@ -459,7 +459,7 @@ public:
                                const unsigned int lineNo, const char * const initMsg,
                                const char * const msg) const
     {
-        this->logErrnoStrNoThrow<Level::ERROR, AppendCauseV>(fileName, funcName, lineNo, initMsg,
+        this->logErrnoStrNoThrow<Level::Error, AppendCauseV>(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
index b1d869458e95b589d89088db52c9e08710d309b0..c3e8c3db1870cc20d3973ab7b6ab828b37020d0d 100644 (file)
@@ -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();
 
index 28f5be4741b92b5f04805d35787e94a248cfbd53..ea597da228fd9fde4febd56f550e91353ade6c08 100644 (file)
@@ -33,45 +33,45 @@ namespace {
 bt2::OptionalBorrowedObject<bt2::ConstClockSnapshot> 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;
     }
 }
 
index 2ae663f8bca9406b02fea5a002a31b6891f3db36..4d89da390f051e1c7293ed02b83b48f015af3b3a 100644 (file)
@@ -33,8 +33,8 @@ public:
     /* Return type of reload() */
     enum class ReloadStatus
     {
-        MORE,
-        NO_MORE,
+        More,
+        NoMore,
     };
 
     /*
index a8a4d626b7f0d0ac0fd07ef3142825d0b6f68b4d..aa7e68768390aaa4b4e1fb0692fbbbe6ed2b4de2 100644 (file)
@@ -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<ClockClsCompatRunIn::MsgType, 2> 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<RunInCondTrigger<ClockClsCompatRunIn>>(
                     ClockClsCompatRunIn {msgType1, createClockCls1, msgType2, createClockCls2},
-                    CondTrigger::Type::POST, condId, fmt::format("{}-{}", msgType1, msgType2)));
+                    CondTrigger::Type::Post, condId, fmt::format("{}-{}", msgType1, msgType2)));
             }
         }
     };
index 3e1cfe864140ee0afe0fee53ba262a913ade2cab..1c174c0158cc672c26d91282b5986c39c0008657 100644 (file)
@@ -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);
index b7d2c487e03504eac70ed44f47f8ebb826154b55..4d4e3b1dd14454248f787722922605e45ded7279 100644 (file)
@@ -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 : "")}
 {
 }
index d8abfafe11ac2ad2c2861146bbd80423c86dd58b..2ea53bc4e8d7739f488df13decac8f8d8f514986 100644 (file)
@@ -37,8 +37,8 @@ public:
      */
     enum class Type
     {
-        PRE,
-        POST,
+        Pre,
+        Post,
     };
 
 protected:
index c922d8ccbfd2bb9a0e8842a5855e7e6a3a5278ff..ef05d1d590d518f37598ab4a8b088a0a0bcac0ad 100644 (file)
@@ -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<MsgType, 2> 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<std::uint64_t> {10} :
                                                     bt2s::nullopt});
         const auto srcComp2 =
This page took 0.056253 seconds and 4 git commands to generate.