Skip to content

Commit 8cf693d

Browse files
committed
Removing clang flag that is unknown, fixing missing forward declare for struct on MSVC, and lastly casting the value of int found by clang
1 parent 9580169 commit 8cf693d

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ endif()
6565

6666
list(APPEND GCC_CLANG_COMPILE_FLAGS
6767
-Wall -Wextra -Wpedantic
68-
-Warith-conversion -Wconversion
69-
-Wint-in-bool-context
70-
-Wmissing-declarations
68+
-Wconversion -Wint-in-bool-context
69+
-Wmissing-declarations -Wmissing-field-initializers
7170
-Werror
7271
)
7372

‎src/dbc.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const auto whiteSpace = "\\s";
2727

2828
enum VALToken { Identifier = 0, CANId, SignalName, Value, Description };
2929

30+
struct VALObject;
3031
struct VALObject {
3132
uint32_t can_id;
3233
std::string signal_name;

‎src/message.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ Message::ParseSignalsStatus Message::parseSignals(const std::vector<uint8_t>& da
5757
const int negative = (v & (1ull << (signal.size - 1))) != 0;
5858
int64_t nativeInt;
5959
if (negative)
60-
nativeInt = v | ~((1ull << signal.size) - 1); // invert all bits above signal.size
60+
nativeInt = static_cast<int64_t>(v | ~((1ull << signal.size) - 1)); // invert all bits above signal.size
6161
else
62-
nativeInt = v & ((1ull << signal.size) - 1); // masking
62+
nativeInt = static_cast<int64_t>(v & ((1ull << signal.size) - 1)); // masking
6363
values.push_back(static_cast<double>(nativeInt) * signal.factor + signal.offset);
6464
break;
6565
}

0 commit comments

Comments
 (0)