annotate test/testtypes.c @ 1393:cd3362657144

Pass LDFLAGS to the build system
author Sam Lantinga <slouken@libsdl.org>
date Mon, 20 Feb 2006 20:08:29 +0000
parents 835c1831f903
children
rev   line source
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 #include <stdio.h>
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
3 #include "SDL_main.h"
1387
835c1831f903 Tests require SDL 1.2.10
Sam Lantinga <slouken@libsdl.org>
parents: 1154
diff changeset
4 #include "SDL_stdinc.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5
1154
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
6 /*
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
7 * Watcom C flags these as Warning 201: "Unreachable code" if you just
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
8 * compare them directly, so we push it through a function to keep the
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
9 * compiler quiet. --ryan.
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
10 */
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
11 static int badsize(size_t sizeoftype, size_t hardcodetype)
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
12 {
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
13 return sizeoftype != hardcodetype;
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
14 }
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
15
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
16 int main(int argc, char *argv[])
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
17 {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18 int error = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 int verbose = 1;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
20
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 if ( argv[1] && (strcmp(argv[1], "-q") == 0) )
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22 verbose = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
23
1154
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
24 if ( badsize(sizeof(Uint8), 1) ) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
25 if ( verbose )
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26 printf("sizeof(Uint8) != 1, instead = %d\n",
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27 sizeof(Uint8));
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28 ++error;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29 }
1154
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
30 if ( badsize(sizeof(Uint16), 2) ) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31 if ( verbose )
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 printf("sizeof(Uint16) != 2, instead = %d\n",
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 sizeof(Uint16));
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 ++error;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 }
1154
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
36 if ( badsize(sizeof(Uint32), 4) ) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
37 if ( verbose )
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
38 printf("sizeof(Uint32) != 4, instead = %d\n",
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
39 sizeof(Uint32));
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
40 ++error;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 #ifdef SDL_HAS_64BIT_TYPE
1154
d93862a3d821 Fixed compiler warnings in Watcom C.
Ryan C. Gordon <icculus@icculus.org>
parents: 47
diff changeset
43 if ( badsize(sizeof(Uint64), 8) ) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
44 if ( verbose )
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
45 printf("sizeof(Uint64) != 8, instead = %d\n",
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
46 sizeof(Uint64));
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
47 ++error;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
48 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
49 #else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
50 if ( verbose ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51 printf("WARNING: No 64-bit datatype on this platform\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
52 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
53 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
54 if ( verbose && ! error )
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
55 printf("All data types are the expected size.\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
56
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
57 return( error ? 1 : 0 );
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
58 }