Skip to content

Commit 5835ebf

Browse files
authored
Mark the 8->32 converter's "pad" field as "maybe_unused". (#178)
Use the [[maybe_unused]] attribute to avoid a warning about the pad_ field being unused. This is preferable to the extra assignment that was previously used.
1 parent 2446924 commit 5835ebf

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

include/icubaby/icubaby.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,7 @@ template <> class transcoder<char8, char32_t> {
888888
///
889889
/// \param well_formed The initial value for the transcoder's "well formed" state.
890890
explicit constexpr transcoder (bool well_formed) noexcept
891-
: code_point_{0}, well_formed_{static_cast<std::uint_least32_t> (well_formed)}, pad_{0}, state_{accept} {
892-
// NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
893-
pad_ = 0; // Suppress warning about pad_ being unused.
894-
}
891+
: code_point_{0}, well_formed_{static_cast<std::uint_least32_t> (well_formed)}, pad_{0}, state_{accept} {}
895892

896893
/// Accepts a code unit in the UTF-8 source encoding. As UTF-32 output code units are generated, they are written to
897894
/// the output iterator \p dest.
@@ -999,7 +996,7 @@ template <> class transcoder<char8, char32_t> {
999996
/// True if the input consumed is well formed, false otherwise.
1000997
std::uint_least32_t well_formed_ : 1;
1001998
/// Pad bits intended to put the next value to a byte boundary.
1002-
std::uint_least32_t pad_ : 2;
999+
[[maybe_unused]] std::uint_least32_t pad_ : 2;
10031000
enum : std::uint_least8_t { accept = 0, reject = 12 };
10041001
/// The state of the converter.
10051002
std::uint_least32_t state_ : 8;

0 commit comments

Comments
 (0)