Warnings in IAR compiler
Created by: richnwhit
I know the IAR Compiler isn't a supported option, but the project is working fine on it and compiles with just two warnings, so I thought it worth reporting these especially as they look sensible.
template <typename TAdaptedString>
inline bool slotSetKey(VariantSlot* var, TAdaptedString key, MemoryPool* pool,
storage_policy::decide_at_runtime) {
if (key.isStatic()) {
return slotSetKey(var, key, pool, storage_policy::store_by_address());
} else {
return slotSetKey(var, key, pool, storage_policy::store_by_copy());
}
return true; // <-- warning here
}
Warning : Statement is unreachable
void visitPositiveInteger(UInt value) {
if (value <= 0x7F) {
writeInteger(uint8_t(value));
} else if (value <= 0xFF) {
writeByte(0xCC);
writeInteger(uint8_t(value));
} else if (value <= 0xFFFF) {
writeByte(0xCD);
writeInteger(uint16_t(value));
} else if (value <= 0xFFFFFFFF) { // <-- Warning here
writeByte(0xCE);
writeInteger(uint32_t(value));
}
#if ARDUINOJSON_USE_LONG_LONG
else {
writeByte(0xCF);
writeInteger(uint64_t(value));
}
#endif
}
Warning: Pointless integer comparison, the result is always true