compiles clean with lots of -W switches

This commit is contained in:
Mark Borgerding 2004-02-26 03:43:23 +00:00
parent 624f8edfd3
commit 0fd8da731a
6 changed files with 35 additions and 20 deletions

View File

@ -1,3 +1,9 @@
WARNINGS=-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return \
-Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast \
-Wwrite-strings
ifeq "$(NFFT)" ""
NFFT=1800
endif
@ -42,7 +48,7 @@ tools:
# for x86 pentium+ machines , these flags work well
#CFLAGS=-Wall -O3 -pedantic -march=pentiumpro -ffast-math -fomit-frame-pointer -I.. -I../tools
# If the above flags do not work, try the following
CFLAGS=-Wall -O3 -I.. -I../tools
CFLAGS=-Wall -O3 -I.. -I../tools $(WARNINGS)
$(SELFTEST): $(SELFTESTSRC) $(SRCFILES)
$(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) -lm $+

View File

@ -4,16 +4,19 @@
#include <sys/types.h>
#include <unistd.h>
#include "pstats.h"
static struct tms tms_beg;
static struct tms tms_end;
static int has_times = 0;
void pstats_init()
void pstats_init(void)
{
has_times = times(&tms_beg) != -1;
}
static void tms_report()
static void tms_report(void)
{
double cputime;
if (! has_times )
@ -25,7 +28,7 @@ static void tms_report()
fprintf(stderr,"\tcputime=%.3f\n" , cputime);
}
static void ps_report()
static void ps_report(void)
{
char buf[1024];
#ifdef __APPLE__ /* MAC OS X */

View File

@ -1,7 +1,7 @@
#ifndef PSTATS_H
#define PSTATS_H
void pstats_init();
void pstats_report();
void pstats_init(void);
void pstats_report(void);
#endif

View File

@ -4,6 +4,7 @@
#define xstr(s) str(s)
#define str(s) #s
static
double snr_compare( kiss_fft_cpx * test_vec_out,kiss_fft_cpx * testbuf, int n)
{
int k;
@ -28,10 +29,11 @@ double snr_compare( kiss_fft_cpx * test_vec_out,kiss_fft_cpx * testbuf, int n)
return snr;
}
int test_stride();
int test2d();
int test_stride(void );
int test2d(void );
int main() { int exit_code=0;
int main(void) {
int exit_code=0;
#define NFFT 10
{
@ -143,6 +145,7 @@ int main() { int exit_code=0;
return exit_code;
}
int test_stride()
{
#define SKIP_FACTOR 7

View File

@ -2,6 +2,8 @@
#define xstr(s) str(s)
#define str(s) #s
static
double snr_compare( kiss_fft_cpx * test_vec_out,kiss_fft_cpx * testbuf, int n)
{
int k;
@ -26,7 +28,7 @@ double snr_compare( kiss_fft_cpx * test_vec_out,kiss_fft_cpx * testbuf, int n)
return snr;
}
int main() { int exit_code=0;
int main(void) { int exit_code=0;
#define NFFT 10
{

View File

@ -4,13 +4,14 @@
#include <time.h>
#include <unistd.h>
static double cputime()
static double cputime(void)
{
struct tms t;
times(&t);
return (double)(t.tms_utime + t.tms_stime)/ sysconf(_SC_CLK_TCK) ;
}
static
double snr_compare( kiss_fft_cpx * vec1,kiss_fft_cpx * vec2, int n)
{
int k;
@ -52,12 +53,12 @@ double snr_compare( kiss_fft_cpx * vec1,kiss_fft_cpx * vec2, int n)
#endif
int main()
int main(void)
{
double ts,tfft,trfft;
int i;
kiss_fft_cpx cin[NFFT];
kiss_fft_scalar sin[NFFT] = {0.309655,0.815653,0.768570,0.591841,0.404767,0.637617,0.007803,0.012665};
kiss_fft_scalar rin[NFFT] = {0.309655,0.815653,0.768570,0.591841,0.404767,0.637617,0.007803,0.012665};
kiss_fft_cpx cout[NFFT];
kiss_fft_cpx sout[NFFT];
@ -68,16 +69,16 @@ int main()
for (i=0;i<NFFT;++i) {
#ifdef RANDOM
sin[i] = (kiss_fft_scalar)(rand()-RAND_MAX/2);
rin[i] = (kiss_fft_scalar)(rand()-RAND_MAX/2);
#endif
cin[i].r = sin[i];
cin[i].r = rin[i];
cin[i].i = 0;
}
kiss_fft_state = kiss_fft_alloc(NFFT,0,0,0);
kiss_fftr_state = kiss_fftr_alloc(NFFT,0,0,0);
kiss_fft(kiss_fft_state,cin,cout);
kiss_fftr(kiss_fftr_state,sin,sout);
kiss_fftr(kiss_fftr_state,rin,sout);
printf( "nfft=%d, inverse=%d, snr=%g\n",
NFFT,0, snr_compare(cout,sout,(NFFT/2)+1) );
#ifdef RANDOM
@ -89,8 +90,8 @@ int main()
ts = cputime();
for (i=0;i<NUMFFTS;++i) {
kiss_fftr( kiss_fftr_state, sin, cout );
/* kiss_fftri(kiss_fftr_state,cout,sin); */
kiss_fftr( kiss_fftr_state, rin, cout );
/* kiss_fftri(kiss_fftr_state,cout,rin); */
}
trfft = cputime() - ts;
@ -103,10 +104,10 @@ int main()
kiss_fftr_state = kiss_fftr_alloc(NFFT,1,0,0);
kiss_fft(kiss_fft_state,cout,cin);
kiss_fftri(kiss_fftr_state,cout,sin);
kiss_fftri(kiss_fftr_state,cout,rin);
for (i=0;i<NFFT;++i) {
sout[i].r = sin[i];
sout[i].r = rin[i];
sout[i].i = 0;
}