Thanks for this.

Regards--
Subrata

On Sun, 2008-12-21 at 07:52 -0800, CAI Qian wrote:
> Hi,
> 
> This patch fix the following warnings,
> 
> tlibio.c: In function ‘lio_write_buffer’:
> tlibio.c:702: warning: cast to pointer from integer of different size
> tlibio.c: In function ‘lio_read_buffer’:
> tlibio.c:1252: warning: cast to pointer from integer of different size
> openfile.c: In function ‘main’:
> openfile.c:139: warning: cast to pointer from integer of different size
> openfile.c: In function ‘threads’:
> openfile.c:187: warning: cast from pointer to integer of different size
> childmain.c: In function ‘ChildMain’:
> childmain.c:551: warning: cast to pointer from integer of different size
> childmain.c:559: warning: cast to pointer from integer of different size
> childmain.c:569: warning: cast to pointer from integer of different size
> childmain.c:838: warning: cast to pointer from integer of different size
> main.c: In function ‘threadedMain’:
> main.c:258: warning: cast to pointer from integer of different size
> main.c:259: warning: cast to pointer from integer of different size
> main.c:266: warning: cast to pointer from integer of different size
> main.c:365: warning: cast to pointer from integer of different size
> timer.c: In function ‘ChildTimer’:
> timer.c:196: warning: cast to pointer from integer of different size
> mallocstress.c: In function ‘alloc_mem’:
> mallocstress.c:272: warning: cast from pointer to integer of different size
> mallocstress.c:275: warning: cast from pointer to integer of different size
> mallocstress.c:276: warning: cast to pointer from integer of different size
> mallocstress.c: In function ‘main’:
> mallocstress.c:368: warning: cast to pointer from integer of different size
> shm_test.c: In function ‘shmat_rd_wr’:
> shm_test.c:207: warning: cast to pointer from integer of different size
> shm_test.c:221: warning: cast to pointer from integer of different size
> shm_test.c:266: warning: cast to pointer from integer of different size
> shm_test.c:270: warning: cast to pointer from integer of different size
> pthserv.c: In function ‘main’:
> pthserv.c:157: warning: cast to pointer from integer of different size
> pthserv.c:157: warning: passing argument 3 of ‘pthread_create’ from 
> incompatible pointer type
> pthserv.c: In function ‘new_thread’:
> pthserv.c:172: warning: cast from pointer to integer of different size
> HTutils.c: In function ‘is_cmdline_para’:
> HTutils.c:24: warning: unused variable ‘i’
> HTutils.c: In function ‘is_ht_kernel’:
> HTutils.c:45: warning: unused variable ‘i’
> HTutils.c: In function ‘is_cmdline_para’:
> HTutils.c:24: warning: unused variable ‘i’
> HTutils.c: In function ‘is_ht_kernel’:
> HTutils.c:45: warning: unused variable ‘i’
> test_1_to_1_threads.c: In function ‘relay’:
> test_1_to_1_threads.c:124: warning: cast from pointer to integer of different 
> size
> test_1_to_1_threads.c: In function ‘main’:
> test_1_to_1_threads.c:178: warning: cast to pointer from integer of different 
> size
> 
> After applied the patch, there are only a few left, :)
> 
> /tmp/ccNWHysR.o: In function `__static_initialization_and_destruction_0(int, 
> int)':
> callGen.cpp:(.text+0x46): warning: the use of `tempnam' is dangerous, better 
> use `mkstemp'
> /tmp/ccevk2H7.o: In function `__static_initialization_and_destruction_0(int, 
> int)':
> callGen_standAlone.cpp:(.text+0x46): warning: the use of `tempnam' is 
> dangerous, better use `mkstemp'
> ../../include/linux_syscall_numbers.h:18: warning: ‘cleanup’ declared 
> ‘static’ but never defined
> ../../include/linux_syscall_numbers.h:18: warning: ‘cleanup’ declared 
> ‘static’ but never defined
> 
> Signed-off-by: CAI Qian <[email protected]>
> 
> --- ./lib/tlibio.c.orig       2008-12-21 22:25:28.362682789 +0800
> +++ ./lib/tlibio.c    2008-12-21 22:24:40.248678603 +0800
> @@ -94,6 +94,7 @@
>  #include <sys/types.h>
>  #include <sys/file.h>
>  #include <signal.h>
> +#include <stdint.h>
>  #ifdef CRAY
>  #include <sys/secparm.h>
>  #include <sys/iosw.h>
> @@ -699,7 +700,7 @@
>                */
>               aiocbp.aio_sigevent.sigev_notify = SIGEV_THREAD;
>               aiocbp.aio_sigevent.sigev_notify_function = 
> lio_async_callback_handler;
> -             aiocbp.aio_sigevent.sigev_notify_attributes = (void*)size;
> +             aiocbp.aio_sigevent.sigev_notify_attributes = 
> (void*)(uintptr_t)size;
>       }
>  #endif
>      /*
> @@ -1249,7 +1250,7 @@
>               /* sival_int just has to be something that I can use
>                * to identify the callback, and "size" happens to be handy...
>                */
> -             aiocbp.aio_sigevent.sigev_notify_attributes = (void*)size;
> +             aiocbp.aio_sigevent.sigev_notify_attributes = 
> (void*)(uintptr_t)size;
>       }
>  #endif
>  
> --- ./testcases/kernel/sched/clisrv/pthserv.c.orig    2008-12-21 
> 22:54:27.035678846 +0800
> +++ ./testcases/kernel/sched/clisrv/pthserv.c 2008-12-21 22:59:35.079678864 
> +0800
> @@ -39,6 +39,7 @@
>  #include "inet.h"
>  #include <stdlib.h>
>  #include <unistd.h>
> +#include <stdint.h>
>  
>  #define MAXLINE 1024
>  void noprintf(char* string, ...){
> @@ -89,7 +90,7 @@
>  int
>  main(int argc, char *argv[])
>  {
> -    void new_thread(void*);
> +    void *new_thread(void*);
>      pthread_attr_t newattr;
>      int newsockfd;
>      socklen_t clilen;
> @@ -154,7 +155,8 @@
>           }
>           else /* create thread to handle client request */
>           {
> -             if (pthread_create(&th, &newattr, new_thread, (void 
> *)newsockfd))
> +             if (pthread_create(&th, &newattr, new_thread,
> +                     (void *)(uintptr_t)newsockfd))
>                   printf("failure to create thread\n");
>  #ifndef _LINUX
>               yield();
> @@ -167,9 +169,10 @@
>      close(sockfd);   
>  }
>  
> -void new_thread(void* arg_)
> +void *
> +new_thread(void* arg_)
>      {
> -    int arg=(int)arg_;
> +    int arg=(uintptr_t)arg_;
>      if (pthread_mutex_lock (&current_mutex))
>       printf("mutex_lock failed");
>      if (str_echo(arg) < 0) /* process the request */
> --- ./testcases/kernel/sched/hyperthreading/ht_interrupt/Makefile.orig        
> 2008-12-21 23:03:09.545678723 +0800
> +++ ./testcases/kernel/sched/hyperthreading/ht_interrupt/Makefile     
> 2008-12-21 23:03:18.415678645 +0800
> @@ -1,6 +1,6 @@
>  # Check that the definitions below are correct for your system
>  
> -CFLAGS+=     -I../../../../../include
> +CFLAGS+=     -I../../../../../include -Wall
>  LOADLIBES+=  -L../../../../../lib -lltp
>  TARGETS = ht_interrupt
>  
> --- ./testcases/kernel/sched/hyperthreading/ht_enabled/Makefile.orig  
> 2008-12-21 23:01:55.185680355 +0800
> +++ ./testcases/kernel/sched/hyperthreading/ht_enabled/Makefile       
> 2008-12-21 23:02:03.647679146 +0800
> @@ -1,6 +1,6 @@
>  # Check that the definitions below are correct for your system
>  
> -CFLAGS   +=  -I../../../../../include
> +CFLAGS   +=  -I../../../../../include -Wall
>  LOADLIBES+=  -L../../../../../lib -lltp
>  TARGETS  := ht_enabled
>  
> --- ./testcases/kernel/sched/hyperthreading/ht_enabled/HTutils.c.orig 
> 2008-12-21 23:02:20.961678638 +0800
> +++ ./testcases/kernel/sched/hyperthreading/ht_enabled/HTutils.c      
> 2008-12-21 23:02:40.255680053 +0800
> @@ -21,7 +21,6 @@
>  int is_cmdline_para(const char *para)
>  {
>       FILE *fp;
> -     int i;
>  
>       if((fp=fopen("/proc/cmdline","r"))!=NULL && para!=NULL)
>       {
> @@ -42,7 +41,6 @@
>  int is_ht_kernel()
>  {
>       FILE *fp;
> -     int i;
>  
>       if((fp=fopen("/proc/cpuinfo","r"))!=NULL)
>       {
> --- ./testcases/kernel/fs/openfile/openfile.c.orig    2008-12-21 
> 22:26:13.904678082 +0800
> +++ ./testcases/kernel/fs/openfile/openfile.c 2008-12-21 22:30:54.487679716 
> +0800
> @@ -33,6 +33,7 @@
>  #include <pthread.h>
>  #include <stdio.h>
>  #include <stdlib.h>
> +#include <stdint.h>
>  #include <unistd.h>
>  
> 
> @@ -136,7 +137,8 @@
>  
>       /* Create threads */
>       for (i=0; i<numthreads; i++)
> -             if (pthread_create(&th_id, (pthread_attr_t *)NULL, threads, 
> (void *)i)) {
> +             if (pthread_create(&th_id, (pthread_attr_t *)NULL, threads,
> +                             (void *)(uintptr_t)i)) {
>                       perror("FAIL - failed creating a pthread; increase 
> limits");
>                       fclose(fd);
>                       unlink(filename);
> @@ -184,7 +186,7 @@
>  /* threads: Each thread opens the files specified */
>  void * threads(void* thread_id_)
>  {
> -  int thread_id=(int)thread_id_;
> +  int thread_id=(uintptr_t)thread_id_;
>       char  errmsg[80];
>          FILE  *fd;
>       int   i;
> --- ./testcases/kernel/mem/mtest07/mallocstress.c.orig        2008-12-21 
> 22:42:54.297680654 +0800
> +++ ./testcases/kernel/mem/mtest07/mallocstress.c     2008-12-21 
> 22:46:59.255681170 +0800
> @@ -69,6 +69,7 @@
>  #include <math.h>
>  #include <assert.h>
>  #include <errno.h>
> +#include <stdint.h>
>  #include <sys/types.h>
>  #include <sys/ipc.h>
>  #include <sys/sem.h>
> @@ -269,11 +270,11 @@
>      }
>  
>      /* thread N will use growth scheme N mod 4 */
> -    int err = allocate_free(num_loop, ((int)threadnum) % 4);
> +    int err = allocate_free(num_loop, ((uintptr_t)threadnum) % 4);
>      fprintf(stdout, 
>      "Thread [%d]: allocate_free() returned %d, %s.  Thread exiting.\n",
> -    (int)threadnum, err, (err ? "failed" : "succeeded"));
> -    return (void *)(err ? -1 : 0);
> +    (int)(uintptr_t)threadnum, err, (err ? "failed" : "succeeded"));
> +    return (void *)(uintptr_t)(err ? -1 : 0);
>  }
>          
>  
> @@ -365,7 +366,8 @@
>  
>      for (thrd_ndx = 0; thrd_ndx < num_thrd; thrd_ndx++)
>      {
> -        if (pthread_create(&thrdid[thrd_ndx], NULL, alloc_mem, (void 
> *)thrd_ndx))
> +        if (pthread_create(&thrdid[thrd_ndx], NULL, alloc_mem,
> +             (void *)(uintptr_t)thrd_ndx))
>          {
>           int err = errno;
>           if (err == EINTR) {
> --- ./testcases/kernel/mem/mtest07/shm_test.c.orig    2008-12-21 
> 22:47:33.264678127 +0800
> +++ ./testcases/kernel/mem/mtest07/shm_test.c 2008-12-21 22:54:05.495681014 
> +0800
> @@ -56,6 +56,7 @@
>  #include <sys/shm.h>    /* required by shmat() shmdt(), shmctl()             
>  */
>  #include <sys/mman.h>   /* required by mmap()                                
>  */
>  #include <fcntl.h>   /* required by open()                                 */
> +#include <stdint.h>  /* required by uintptr_t                              */
>  
>  void noprintf(char* string, ...){
>  }
> @@ -69,7 +70,7 @@
>  #define PTHREAD_EXIT(val)    do {\
>                       exit_val = val; \
>                          dprt("pid[%d]: exiting with %d\n", 
> getpid(),exit_val); \
> -                     pthread_exit((void *)exit_val); \
> +                     pthread_exit((void *)(uintptr_t)exit_val); \
>                               } while (0)
>  
>  #define OPT_MISSING(prog, opt)   do{\
> --- ./testcases/kernel/io/disktest/childmain.c.orig   2008-12-21 
> 22:31:55.272678308 +0800
> +++ ./testcases/kernel/io/disktest/childmain.c        2008-12-21 
> 22:38:10.590678589 +0800
> @@ -29,6 +29,7 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <stdarg.h>
> +#include <stdint.h>
>  #ifdef WINDOWS
>  #include <windows.h>
>  #include <winioctl.h>
> @@ -548,7 +549,7 @@
>       if(INVALID_FD(fd)) {
>               pMsg(ERR, args, "Thread %d: could not open %s, errno = %u.\n", 
> this_thread_id,args->device, GETLASTERROR());
>               args->test_state = SET_STS_FAIL(args->test_state);
> -             TEXIT(GETLASTERROR());
> +             TEXIT((uintptr_t)GETLASTERROR());
>       }
>  
>       /* Create aligned memory buffers for sending IO. */
> @@ -556,7 +557,7 @@
>               pMsg(ERR, args, "Thread %d: Memory allocation failure for IO 
> buffer, errno = %u\n", this_thread_id, GETLASTERROR());
>               args->test_state = SET_STS_FAIL(args->test_state);
>               CLOSE(fd);
> -             TEXIT(GETLASTERROR());
> +             TEXIT((uintptr_t)GETLASTERROR());
>       }
>       memset(buffer1, SET_CHAR, ((args->htrsiz*BLK_SIZE)+ALIGNSIZE));
>       buf1 = (char *) BUFALIGN(buffer1);
> @@ -566,7 +567,7 @@
>               FREE(buffer1);
>               args->test_state = SET_STS_FAIL(args->test_state);
>               CLOSE(fd);
> -             TEXIT(GETLASTERROR());
> +             TEXIT((uintptr_t)GETLASTERROR());
>       }
>       memset(buffer2, SET_CHAR, ((args->htrsiz*BLK_SIZE)+ALIGNSIZE));
>       buf2 = (char *) BUFALIGN(buffer2);
> @@ -835,6 +836,6 @@
>               args->test_state = SET_STS_FAIL(args->test_state);
>       }
>  
> -     TEXIT(exit_code);
> +     TEXIT((uintptr_t)exit_code);
>  }
>  
> --- ./testcases/kernel/io/disktest/main.c.orig        2008-12-21 
> 22:39:18.568680256 +0800
> +++ ./testcases/kernel/io/disktest/main.c     2008-12-21 22:41:01.143680033 
> +0800
> @@ -40,6 +40,7 @@
>  #endif
>  #include <stdlib.h>
>  #include <stdarg.h>
> +#include <stdint.h>
>  #include <signal.h>
>  #include <time.h>
>  #include <errno.h>
> @@ -255,15 +256,15 @@
>  
>       init_gbl_data(test->env);
>  
> -     if(make_assumptions(test->args) < 0) { TEXIT(GETLASTERROR()); }
> -     if(check_conclusions(test->args) < 0) { TEXIT(GETLASTERROR()); }
> +     if(make_assumptions(test->args) < 0) { 
> TEXIT((uintptr_t)GETLASTERROR()); }
> +     if(check_conclusions(test->args) < 0) { 
> TEXIT((uintptr_t)GETLASTERROR()); }
>       if(test->args->flags & CLD_FLG_DUMP) {
>               /*
>                * All we are doing is dumping filespec data to STDOUT, so
>                * we will do this here and be done.
>                */
>               do_dump(test->args);
> -             TEXIT(GETLASTERROR());
> +             TEXIT((uintptr_t)GETLASTERROR());
>       } else {
>               ulRV = init_data(test, &data_buffer_unaligned);
>               if(ulRV != 0) { TEXIT(ulRV); }
> @@ -362,7 +363,7 @@
>                       pMsg(END, test->args, "Test Done (Failed)\n");
>               }
>       }
> -     TEXIT(GETLASTERROR());
> +     TEXIT((uintptr_t)GETLASTERROR());
>  }
>  
>  /*
> --- ./testcases/kernel/io/disktest/timer.c.orig       2008-12-21 
> 22:41:32.214678741 +0800
> +++ ./testcases/kernel/io/disktest/timer.c    2008-12-21 22:42:28.254678249 
> +0800
> @@ -41,6 +41,7 @@
>  #endif
>  #include <stdlib.h>
>  #include <stdarg.h>
> +#include <stdint.h>
>  #include <signal.h>
>  #include <time.h>
>  #include <errno.h>
> @@ -193,7 +194,7 @@
>               env->bContinue = FALSE;
>       }
>  
> -     TEXIT(GETLASTERROR());
> +     TEXIT((uintptr_t)GETLASTERROR());
>  }
>  
>  #ifdef _DEBUG
> --- ./testcases/network/sctp/func_tests/Makefile.orig 2008-12-21 
> 23:13:13.161680370 +0800
> +++ ./testcases/network/sctp/func_tests/Makefile      2008-12-21 
> 23:13:25.872679313 +0800
> @@ -22,7 +22,7 @@
>  INCLUDES += -I../../../../include -I../include -I../testlib
>  LIBS += -L../../../../lib -L../lib -L../testlib
>  
> -CFLAGS += -g $(INCLUDES) -DLTP
> +CFLAGS += -g $(INCLUDES) -DLTP -Wall
>  
>  LOADLIBES += $(LIBS) -lltp -lsctputil -lsctp -lpthread
>  
> --- ./testcases/network/sctp/func_tests/test_1_to_1_threads.c.orig    
> 2008-12-21 23:11:16.161678974 +0800
> +++ ./testcases/network/sctp/func_tests/test_1_to_1_threads.c 2008-12-21 
> 23:12:32.471678236 +0800
> @@ -47,6 +47,7 @@
>  #include <errno.h>
>  #include <netinet/sctp.h>
>  #include <sys/uio.h>
> +#include <stdint.h>
>  #include <linux/socket.h>
>  #include <sctputil.h>
>  
> @@ -121,7 +122,7 @@
>  }
>  
>  void * relay (void* id_) {
> -     int id=(int)id_;
> +     int id=(uintptr_t)id_;
>       if (id == 0) {
>               t_send(id);
>       } else if (id == THREADS -1) {
> @@ -175,7 +176,7 @@
>       for ( i = 0; i < THREAD_SND_RCV_LOOPS; i++ ) {
>               for (cnt = 1; cnt < THREADS; cnt++) {
>                       status = pthread_create(&thread[cnt], &attr,
> -                                             relay, (void*)cnt);
> +                                             relay, (void*)(uintptr_t)cnt);
>                       if (status)
>                               tst_brkm(TBROK, tst_exit, "pthread_create "
>                                        "failed status:%d, errno:%d", status,
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to