eModbus / eModbus

Modbus library for RTU, ASCII and TCP protocols. Primarily developed on and for ESP32 MCUs.

Home Page:https://emodbus.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Few compiler warnings to solve

bertmelis opened this issue · comments

ModbusTypeDefs.h:127:10: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
   static const FCType getType(uint8_t functionCode);
          ^~~~~
ModbusTypeDefs.h:132:10: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
   static const FCType redefineType(uint8_t functionCode, const FCType type = FCUSER);
          ^~~~~
RTUutils.cpp:373:40: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
           if ((b & 0x80) || ASCIIread[b] == 0xFF) {
                             ~~~~~~~~~~~^

The last error is a false positive but can be easily avoided at line 240: int b; to be replaced by int b = 0;

Will do. Not before tomorrow I am afraid - I have been shoving heavy furniture and need some rest 😁

Should be okay now - trivial, I hope. I did not explicitly test it 😊

Argh. Missed to change the ModbusTypeDefs.cpp as well.