Hi

We have a few RTEMS BSPs which use CPUs where float, double,
and long double are the same.  This triggers the printf format
warning because promoting float to double results in float.
At least that's what I think is happening. This happens on at
least the h8sx and sh2e.

$ h8300-rtems4.11-gcc -c -Os -Wall -msx warnf.c
warnf.c: In function 'f':
warnf.c:5:3: warning: format '%f' expects argument of type 'double', but
argument 2 has type 'float' [-Wformat=]
   printf( "%f", X );
   ^
warnf.c:5:3: warning: format '%f' expects argument of type 'double', but
argument 2 has type 'float' [-Wformat=]

The code is:

#include <stdio.h>

void f(float X)
{
  printf( "%f", X );
}

Any ideas? Should I raise a PR?

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherr...@oarcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

Reply via email to