C
Charlie Zender
Hi,
First, this may be a GCC or Linux-specific problem, I'm not sure.
I am unable to compile a large body of code with extremely pedantic
compile time checks activate, so that warnings cause errors.
With GCC 3.3.1, I do this with
gcc -I/usr/local/include -g -O2 -std=c99 -pedantic -pedantic
-D_BSD_SOURCE -Wall -Wunused -W -Wmissing-prototypes -Wconversion
-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings
bug.c -o bug -lm
(This is basically what GSL recommendsd for scientific codes.)
The current problem I have is that the following code (bug.c)
#include <stdio.h>
#include <math.h>
int main()
{
/* float fabsf(float); */
float foo,bar=-9;
foo=fabsf(bar);
fprintf(stdout,"foo = %g\n",foo);
}
produces this warning:
bug.c:7: warning: passing arg 1 of `fabsf' as `float' rather than
`double' due to prototype
_regardless_ of whether the correct fabsf() prototype
(float fabsf(float)
is commented out or not.
Yes, my GNU/Linux system does have fabsf() etc. in libm.a.
Yes, the intrinsics powf(), fabsf(), sqrtf()... cause the same warning.
1. How do I use powf(), fabsf(), sqrtf() etc. with causing compiler
warnings with the above compiler switches?
Thanks to all who have answered my previous three posts!
You've helped me de-lint 90% of my code...if I can fix this
present problem then compiling it with -Werror should work
and thus make catching new bugs at compile time much easier.
Any help appreciated,
Charlie
First, this may be a GCC or Linux-specific problem, I'm not sure.
I am unable to compile a large body of code with extremely pedantic
compile time checks activate, so that warnings cause errors.
With GCC 3.3.1, I do this with
gcc -I/usr/local/include -g -O2 -std=c99 -pedantic -pedantic
-D_BSD_SOURCE -Wall -Wunused -W -Wmissing-prototypes -Wconversion
-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings
bug.c -o bug -lm
(This is basically what GSL recommendsd for scientific codes.)
The current problem I have is that the following code (bug.c)
#include <stdio.h>
#include <math.h>
int main()
{
/* float fabsf(float); */
float foo,bar=-9;
foo=fabsf(bar);
fprintf(stdout,"foo = %g\n",foo);
}
produces this warning:
bug.c:7: warning: passing arg 1 of `fabsf' as `float' rather than
`double' due to prototype
_regardless_ of whether the correct fabsf() prototype
(float fabsf(float)
Yes, my GNU/Linux system does have fabsf() etc. in libm.a.
Yes, the intrinsics powf(), fabsf(), sqrtf()... cause the same warning.
1. How do I use powf(), fabsf(), sqrtf() etc. with causing compiler
warnings with the above compiler switches?
Thanks to all who have answered my previous three posts!
You've helped me de-lint 90% of my code...if I can fix this
present problem then compiling it with -Werror should work
and thus make catching new bugs at compile time much easier.
Any help appreciated,
Charlie