Fixed compiler warnings in Watcom C.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 03 Oct 2005 08:12:32 +0000
changeset 1154d93862a3d821
parent 1153 5bc98ce985c2
child 1155 91569ec25acd
Fixed compiler warnings in Watcom C.
test/testcdrom.c
test/testkeys.c
test/testtypes.c
test/testver.c
test/torturethread.c
     1.1 --- a/test/testcdrom.c	Sun Oct 02 00:50:03 2005 +0000
     1.2 +++ b/test/testcdrom.c	Mon Oct 03 08:12:32 2005 +0000
     1.3 @@ -2,8 +2,9 @@
     1.4  /* Test the SDL CD-ROM audio functions */
     1.5  
     1.6  #include <stdlib.h>
     1.7 -#include <stdio.h>
     1.8  #include <ctype.h>
     1.9 +#include <stdlib.h>
    1.10 +#include <string.h>
    1.11  
    1.12  #include "SDL.h"
    1.13  
     2.1 --- a/test/testkeys.c	Sun Oct 02 00:50:03 2005 +0000
     2.2 +++ b/test/testkeys.c	Mon Oct 03 08:12:32 2005 +0000
     2.3 @@ -3,6 +3,8 @@
     2.4  
     2.5  #include <stdio.h>
     2.6  #include <ctype.h>
     2.7 +#include <stdlib.h>
     2.8 +#include <string.h>
     2.9  
    2.10  #include "SDL.h"
    2.11  
     3.1 --- a/test/testtypes.c	Sun Oct 02 00:50:03 2005 +0000
     3.2 +++ b/test/testtypes.c	Mon Oct 03 08:12:32 2005 +0000
     3.3 @@ -1,8 +1,20 @@
     3.4  
     3.5  #include <stdio.h>
     3.6 +#include <stdlib.h>
     3.7 +#include <string.h>
     3.8  #include "SDL_main.h"
     3.9  #include "SDL_types.h"
    3.10  
    3.11 +/*
    3.12 + * Watcom C flags these as Warning 201: "Unreachable code" if you just
    3.13 + *  compare them directly, so we push it through a function to keep the
    3.14 + *  compiler quiet.  --ryan.
    3.15 + */
    3.16 +static int badsize(size_t sizeoftype, size_t hardcodetype)
    3.17 +{
    3.18 +    return sizeoftype != hardcodetype;
    3.19 +}
    3.20 +
    3.21  int main(int argc, char *argv[])
    3.22  {
    3.23  	int error = 0;
    3.24 @@ -11,26 +23,26 @@
    3.25  	if ( argv[1] && (strcmp(argv[1], "-q") == 0) )
    3.26  		verbose = 0;
    3.27  
    3.28 -	if ( sizeof(Uint8) != 1 ) {
    3.29 +	if ( badsize(sizeof(Uint8), 1) ) {
    3.30  		if ( verbose )
    3.31  			printf("sizeof(Uint8) != 1, instead = %d\n",
    3.32  								sizeof(Uint8));
    3.33  		++error;
    3.34  	}
    3.35 -	if ( sizeof(Uint16) != 2 ) {
    3.36 +	if ( badsize(sizeof(Uint16), 2) ) {
    3.37  		if ( verbose )
    3.38  			printf("sizeof(Uint16) != 2, instead = %d\n",
    3.39  								sizeof(Uint16));
    3.40  		++error;
    3.41  	}
    3.42 -	if ( sizeof(Uint32) != 4 ) {
    3.43 +	if ( badsize(sizeof(Uint32), 4) ) {
    3.44  		if ( verbose )
    3.45  			printf("sizeof(Uint32) != 4, instead = %d\n",
    3.46  								sizeof(Uint32));
    3.47  		++error;
    3.48  	}
    3.49  #ifdef SDL_HAS_64BIT_TYPE
    3.50 -	if ( sizeof(Uint64) != 8 ) {
    3.51 +	if ( badsize(sizeof(Uint64), 8) ) {
    3.52  		if ( verbose )
    3.53  			printf("sizeof(Uint64) != 8, instead = %d\n",
    3.54  								sizeof(Uint64));
     4.1 --- a/test/testver.c	Sun Oct 02 00:50:03 2005 +0000
     4.2 +++ b/test/testver.c	Mon Oct 03 08:12:32 2005 +0000
     4.3 @@ -4,6 +4,7 @@
     4.4  */
     4.5  
     4.6  #include <stdio.h>
     4.7 +#include <stdlib.h>
     4.8  
     4.9  #include "SDL.h"
    4.10  
     5.1 --- a/test/torturethread.c	Sun Oct 02 00:50:03 2005 +0000
     5.2 +++ b/test/torturethread.c	Mon Oct 03 08:12:32 2005 +0000
     5.3 @@ -22,7 +22,7 @@
     5.4  
     5.5  int SubThreadFunc(void *data) {
     5.6  	while(! *(int volatile *)data) {
     5.7 -		; /*SDL_Delay(10); /* do nothing */
     5.8 +		; /*SDL_Delay(10);*/  /* do nothing */
     5.9  	}
    5.10  	return 0;
    5.11  }