Cast problem in test code

Ubuntu Linux/AMD64/gcc 4.0

testsem.c: In function ?ThreadFunc?:
testsem.c:20: warning: cast from pointer to integer of different size
testsem.c:23: warning: cast from pointer to integer of different size
testsem.c:26: warning: cast from pointer to integer of different size
testsem.c: In function ?main?:
testsem.c:59: warning: cast to pointer from integer of different size

torturethread.c: In function ?ThreadFunc?:
torturethread.c:34: warning: cast from pointer to integer of different
size
torturethread.c: In function ?main?:
torturethread.c:73: warning: cast to pointer from integer of different
size–
John Skaller
Async PL, Realtime software consultants
Checkout Felix: http://felix.sourceforge.net

Ubuntu Linux/AMD64/gcc 4.0

testsem.c: In function ???ThreadFunc???:
testsem.c:20: warning: cast from pointer to integer of different size
testsem.c:23: warning: cast from pointer to integer of different size
testsem.c:26: warning: cast from pointer to integer of different size
testsem.c: In function ???main???:
testsem.c:59: warning: cast to pointer from integer of different size

torturethread.c: In function ???ThreadFunc???:
torturethread.c:34: warning: cast from pointer to integer of different
size
torturethread.c: In function ???main???:
torturethread.c:73: warning: cast to pointer from integer of different
size

This might be fixed in CVS…

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

BTW: is there any way to run the tests without installing
the dev version of SDL?

I expected ‘make test’ to run those tests, but found
I had to cd into the test directory. Then run config,
which failed because it called sdl-config which
told me I had the wrong version. Just changing
the PATH of course didn’t fix the real problem.

Luckily, I have Debian based system and the installed
version of SDL lives in /usr/* and the script defaults
to /usr/local/* so I could trial install to run
the tests without clobbering the installed version.
But really the point of tests is to check the build
worked before installing.

Kind of messy if you’re cross compiling.
My own build system can sort of handle that (has to,
since it is building a cross-cross-compiler).On Sat, 2006-03-11 at 14:54 -0800, Sam Lantinga wrote:

Ubuntu Linux/AMD64/gcc 4.0

testsem.c: In function ???ThreadFunc???:
testsem.c:20: warning: cast from pointer to integer of different size
testsem.c:23: warning: cast from pointer to integer of different size
testsem.c:26: warning: cast from pointer to integer of different size
testsem.c: In function ???main???:
testsem.c:59: warning: cast to pointer from integer of different size

torturethread.c: In function ???ThreadFunc???:
torturethread.c:34: warning: cast from pointer to integer of different
size
torturethread.c: In function ???main???:
torturethread.c:73: warning: cast to pointer from integer of different
size

This might be fixed in CVS…


John Skaller
Async PL, Realtime software consultants
Checkout Felix: http://felix.sourceforge.net

One left, or perhaps a new one:

testtimer.c: In function ?callback?:
testtimer.c:30: warning: cast from pointer to integer of different sizeOn Sat, 2006-03-11 at 14:54 -0800, Sam Lantinga wrote:

Ubuntu Linux/AMD64/gcc 4.0

testsem.c: In function ???ThreadFunc???:
testsem.c:20: warning: cast from pointer to integer of different size

This might be fixed in CVS…


John Skaller
Async PL, Realtime software consultants
Checkout Felix: http://felix.sourceforge.net

One left, or perhaps a new one:

testtimer.c: In function ???callback???:
testtimer.c:30: warning: cast from pointer to integer of different size

Fixed.
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

Great! Hmm … now trying with -Wall:

testplatform.c: In function ?TestTypes?:
testplatform.c:25: warning: format ?%d? expects type ?int?, but argument
2 has type ?long unsigned int?
testplatform.c:31: warning: format ?%d? expects type ?int?, but argument
2 has type ?long unsigned int?
testplatform.c:37: warning: format ?%d? expects type ?int?, but argument
2 has type ?long unsigned int?
testplatform.c:44: warning: format ?%d? expects type ?int?, but argument
2 has type ?long unsigned int?
testplatform.c: In function ?TestEndian?:
testplatform.c:113: warning: format ?%llX? expects type ?long long
unsigned int?, but argument 2 has type ?Uint64?
testplatform.c:113: warning: format ?%llX? expects type ?long long
unsigned int?, but argument 3 has type ?Uint64?
gcc -Wall -o testsem testsem.c -g -O2 -I/usr/local/include/SDL
-D_REENTRANT -DHAVE_OPENGL -L/usr/local/lib -Wl,-rpath,/usr/local/lib
-lSDL -lpthread
testsem.c: In function ?ThreadFunc?:
testsem.c:21: warning: format ?%d? expects type ?int?, but argument 3
has type ?uintptr_t?
testsem.c:24: warning: format ?%d? expects type ?int?, but argument 3
has type ?uintptr_t?
testsem.c:27: warning: format ?%d? expects type ?int?, but argument 2
has type ?uintptr_t?
gcc -Wall -o testsprite testsprite.c -g -O2 -I/usr/local/include/SDL
-D_REENTRANT -DHAVE_OPENGL -L/usr/local/lib -Wl,-rpath,/usr/local/lib
-lSDL -lpthread -lm
gcc -Wall -o testtimer testtimer.c -g -O2 -I/usr/local/include/SDL
-D_REENTRANT -DHAVE_OPENGL -L/usr/local/lib -Wl,-rpath,/usr/local/lib
-lSDL -lpthread
testtimer.c: In function ?callback?:
testtimer.c:30: warning: format ?%d? expects type ?int?, but argument 3
has type ?long unsigned int?
testtimer.c: At top level:
testtimer.c:17: warning: ?quit? defined but not used
gcc -Wall -o testver testver.c -g -O2 -I/usr/local/include/SDL
-D_REENTRANT -DHAVE_OPENGL -L/usr/local/lib -Wl,-rpath,/usr/local/lib
-lSDL -lpthread
gcc -Wall -o testvidinfo testvidinfo.c -g -O2 -I/usr/local/include/SDL
-D_REENTRANT -DHAVE_OPENGL -L/usr/local/lib -Wl,-rpath,/usr/local/lib
-lSDL -lpthread
gcc -Wall -o testwin testwin.c -g -O2 -I/usr/local/include/SDL
-D_REENTRANT -DHAVE_OPENGL -L/usr/local/lib -Wl,-rpath,/usr/local/lib
-lSDL -lpthread
gcc -Wall -o testwm testwm.c -g -O2 -I/usr/local/include/SDL
-D_REENTRANT -DHAVE_OPENGL -L/usr/local/lib -Wl,-rpath,/usr/local/lib
-lSDL -lpthread
gcc -Wall -o threadwin threadwin.c -g -O2 -I/usr/local/include/SDL
-D_REENTRANT -DHAVE_OPENGL -L/usr/local/lib -Wl,-rpath,/usr/local/lib
-lSDL -lpthread
gcc -Wall -o torturethread torturethread.c -g -O2
-I/usr/local/include/SDL -D_REENTRANT -DHAVE_OPENGL -L/usr/local/lib
-Wl,-rpath,/usr/local/lib -lSDL -lpthread
torturethread.c: In function ?ThreadFunc?:
torturethread.c:36: warning: format ?%d? expects type ?int?, but
argument 3 has type ?uintptr_t?
torturethread.c:43: warning: format ?%d? expects type ?int?, but
argument 2 has type ?uintptr_t?
torturethread.c:48: warning: format ?%d? expects type ?int?, but
argument 2 has type ?uintptr_t?
torturethread.c:54: warning: format ?%d? expects type ?int?, but
argument 2 has type ?uintptr_t?On Sat, 2006-03-11 at 17:47 -0800, Sam Lantinga wrote:

One left, or perhaps a new one:

testtimer.c: In function ???callback???:
testtimer.c:30: warning: cast from pointer to integer of different size

Fixed.


John Skaller
Async PL, Realtime software consultants
Checkout Felix: http://felix.sourceforge.net

Excuse the now incorrect title of this thread:

Building the main code with -Wall:

./src/audio/esd/SDL_esdaudio.c: In function ‘ESD_WaitAudio’:
./src/audio/esd/SDL_esdaudio.c:192: warning: implicit declaration of
function ‘kill’
./src/audio/esd/SDL_esdaudio.c: In function ‘ESD_PlayAudio’:
./src/audio/esd/SDL_esdaudio.c:211: warning: implicit declaration of
function ‘write’
./src/audio/esd/SDL_esdaudio.c: In function ‘get_progname’:
./src/audio/esd/SDL_esdaudio.c:252: warning: implicit declaration of
function ‘getpid’

./src/video/fbcon/SDL_fb3dfx.c: In function ‘FillHWRect’:
./src/video/fbcon/SDL_fb3dfx.c:75: warning: cast from pointer to integer
of different size
./src/video/fbcon/SDL_fb3dfx.c: In function ‘HWAccelBlit’:
./src/video/fbcon/SDL_fb3dfx.c:146: warning: cast from pointer to
integer of different size
./src/video/fbcon/SDL_fb3dfx.c:148: warning: cast from pointer to
integer of different size

./src/timer/unix/SDL_systimer.c: In function ‘SDL_Delay’:
./src/timer/unix/SDL_systimer.c:116: warning: implicit declaration of
function ‘nanosleep’

There are also a couple of these:

./src/audio/arts/SDL_artsaudio.c:68: warning: dereferencing type-punned
pointer will break strict-aliasing rules

which I don’t think are as important (unless you build with lunatic
optimisation options) but I’m not sure.–
John Skaller
Async PL, Realtime software consultants
Checkout Felix: http://felix.sourceforge.net

Great! Hmm … now trying with -Wall:

Okay, try now…

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

Building the main code with -Wall:

./src/audio/esd/SDL_esdaudio.c: In function ‘ESD_WaitAudio’:
./src/audio/esd/SDL_esdaudio.c:192: warning: implicit declaration of
function ‘kill’
./src/audio/esd/SDL_esdaudio.c: In function ‘ESD_PlayAudio’:
./src/audio/esd/SDL_esdaudio.c:211: warning: implicit declaration of
function ‘write’
./src/audio/esd/SDL_esdaudio.c: In function ‘get_progname’:
./src/audio/esd/SDL_esdaudio.c:252: warning: implicit declaration of
function ‘getpid’

Should be fixed…

./src/video/fbcon/SDL_fb3dfx.c: In function ‘FillHWRect’:
./src/video/fbcon/SDL_fb3dfx.c:75: warning: cast from pointer to integer
of different size
./src/video/fbcon/SDL_fb3dfx.c: In function ‘HWAccelBlit’:
./src/video/fbcon/SDL_fb3dfx.c:146: warning: cast from pointer to
integer of different size
./src/video/fbcon/SDL_fb3dfx.c:148: warning: cast from pointer to
integer of different size

This code probably doesn’t work on 64-bit systems. I don’t suppose you
have a 3Dfx card lying around? :slight_smile:

./src/timer/unix/SDL_systimer.c: In function ‘SDL_Delay’:
./src/timer/unix/SDL_systimer.c:116: warning: implicit declaration of
function ‘nanosleep’

The man page says to include time.h. I do that, and define _GNU_SOURCE=1
Anything I’m missing?

Thanks!
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment