debevv / nanoMODBUS

A compact MODBUS RTU/TCP C library for embedded/microcontrollers
MIT License
234 stars 47 forks source link

Fix Wswitch-enum and Wcast-qual compiler warnings #18

Closed AguileraG closed 1 year ago

AguileraG commented 1 year ago

The function nmbs_strerror does not handle the error code NMBS_ERROR_INVALID_UNIT_ID inside the switch statement, which triggers the GCC/Clang Wswitch-enum warning. Adding a new case inside the switch statement solves this warning.

There is a cast from a const void pointer to an uint8_t pointer inside the function nmbs_send_raw_pdu, which triggers the GCC/Clang Wcast-qual warning. Adding the missing const qualifier solves this warning.

debevv commented 1 year ago

And I thought that -Wall -Wextra included these obvious checks too... Thanks for your contribution