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

warning: 'float' is promoted to 'double' when passed through '...' when compiling on windows #14

Open
stokie-ant opened this issue Jan 27, 2025 · 1 comment

Comments

@stokie-ant
Copy link

the full warning:

D:\Projects\lnDSO150\lnArduino\embedded_printf\printf.c: In function '_vsnprintf':
D:\Projects\lnDSO150\lnArduino\embedded_printf\printf.c:769:15: warning: 'float' is promoted to 'double' when passed through '...'
  769 |         idx = _ftoa(out, buffer, idx, maxlen, va_arg(va, FLOAT_SIZE_TYPE), precision, width, flags);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\Projects\lnDSO150\lnArduino\embedded_printf\printf.c:769:15: note: (so you should pass 'double' not 'float' to 'va_arg')
D:\Projects\lnDSO150\lnArduino\embedded_printf\printf.c:769:15: note: if this code is reached, the program will abort

and it does cause the program to abort, instantly.

Using mingw make and the toolchain from https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/tag/v10.2.1-1.1

solved with a SET(PLATFORM_C_FLAGS "-DPRINTF_DISABLE_SUPPORT_FLOAT ") in platformConfig.cmake

This is the first time for me with STM32 development and first time cross compiling with windows so please forgive me if this is my mis-configuration

@mean00
Copy link
Owner

mean00 commented Jan 29, 2025

Hi
Let me check that one.
The main underlying problem is that i'm trying to avoid double completely.
The GD32F303/CH32V30X have single float support, so the math lib is very small for them (like 1kB)

As soon as you use one function dealing with doubles, you pull the double math software lib and you increase the code size by 5 to 10kB instantly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants