Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up the compiler warnings #6

Open
ceremcem opened this issue Jan 19, 2023 · 0 comments
Open

Clean up the compiler warnings #6

ceremcem opened this issue Jan 19, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@ceremcem
Copy link
Owner

Following warnings are produced when compiled with -Wconversion -std=c99 -pedantic -Wall -Wextra flags:

/home/ceremcem/embedded/gcc/gcc-arm-none-eabi-10-2020-q4-major/bin//arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F407xx -ICore/Inc -IDrivers/STM32F4xx_HAL_Driver/Inc -IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F4xx/Include -IDrivers/CMSIS/Include -Imodbus_lib -O0 -Wconversion -std=c99 -pedantic -Wall -Wextra -Wall -fdata-sections -ffunction-sections -Wextra -g -gdwarf-2 -MMD -MP -MF"build/modbus_lib.d" -Wa,-a,-ad,-alms=build/modbus_lib.lst modbus_lib/modbus_lib.c -o build/modbus_lib.o
modbus_lib/modbus_lib.c: In function 'modbus_lib_end_of_telegram':
modbus_lib/modbus_lib.c:81:43: warning: conversion from 'int' to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
   81 |             outgoing_telegram[oindex++] = count.value * 2;                      // byte count
      |                                           ^~~~~
modbus_lib/modbus_lib.c:84:74: warning: conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} may change value [-Wconversion]
   84 |                 res.value = modbus_lib_read_handler(start_addr.value + i + MB_ADDRESS_HOLDING_REGISTER_OFFSET);
modbus_lib/modbus_lib.c: In function 'modbus_lib_send_error':
modbus_lib/modbus_lib.c:130:13: warning: conversion from 'uint16_t' {aka 'short unsigned int'} to 'unsigned char' may change value [-Wconversion]
  130 |             config->address,
      |             ^~~~~~
modbus_lib/modbus_lib.c:132:13: warning: conversion from 'int' to 'unsigned char' may change value [-Wconversion]
  132 |             error_code
      |             ^~~~~~~~~~
modbus_lib/modbus_lib.c:141:12: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '-1' to '65535' [-Wsign-conversion]
  141 |     return -1;
      |  
@ceremcem ceremcem added the enhancement New feature or request label Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant