Skip to content

Commit

Permalink
Fix warnings when compiling with clang
Browse files Browse the repository at this point in the history
  • Loading branch information
benbarsdell committed Jun 18, 2023
1 parent dd7948f commit 3cebb2b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions rtunits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ class Dimensions {
: exponents_({length_, mass_, time_, current_, temperature_, luminosity_,
amount_}) {}

void _war_unused_private_field_warning() const { (void)padding_byte_; }

array_type exponents_;
value_type padding_byte_ = 0;
};
Expand Down Expand Up @@ -398,6 +400,8 @@ inline std::ostream& operator<<(std::ostream& stream, const Dimensions& dims) {

static_assert(std::is_standard_layout<Dimensions>::value,
"Internal error: Dimensions is not standard layout");
static_assert(sizeof(Dimensions) == 8,
"Internal error: Dimensions is not exactly 8 bytes");

template <typename T>
class Quantity {
Expand Down
4 changes: 2 additions & 2 deletions rtunits_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void test_multi_parsing(std::initializer_list<std::string> symbols,
for (const auto& sep :
{" ", " ", "\t", "*", ",", " * ", " , ", middot, times}) {
std::string combined_symbol = leading_ws;
for (const std::string symbol : symbols) {
for (const std::string& symbol : symbols) {
combined_symbol += symbol + sep;
}
combined_symbol += trailing_ws;
Expand All @@ -305,7 +305,7 @@ void test_multi_parsing(std::initializer_list<std::string> symbols,
if (check_with_bad_separators) {
for (const auto& bad_sep : {"", ".", "-", "&", "|"}) {
std::string combined_symbol = leading_ws;
for (const std::string symbol : symbols) {
for (const std::string& symbol : symbols) {
combined_symbol += symbol + bad_sep;
}
combined_symbol += trailing_ws;
Expand Down

0 comments on commit 3cebb2b

Please sign in to comment.