On Wed, 2008-09-10 at 22:17 +0900, Mitsuru Chinen wrote:
> When we compile the test codes with -Wall option, lots of warning appear.
> It is better to remove them for the future debbuging.
>
> Signed-off-by: Mitsuru Chinen <[EMAIL PROTECTED]>
Last one also through.
Regards--
Subrata
> ---
> testcases/network/lib6/asapi_04.c | 16 +++++++++-------
> testcases/network/lib6/asapi_05.c | 30 +++++++++++++++---------------
> testcases/network/lib6/asapi_06.c | 6 ++----
> testcases/network/lib6/asapi_07.c | 10 +++++-----
> testcases/network/lib6/getaddrinfo_01.c | 5 +++--
> testcases/network/lib6/in6_01.c | 2 +-
> testcases/network/lib6/in6_02.c | 2 +-
> testcases/network/lib6/runcc.c | 15 ++++++++++-----
> 8 files changed, 46 insertions(+), 40 deletions(-)
>
> diff --git a/testcases/network/lib6/asapi_04.c
> b/testcases/network/lib6/asapi_04.c
> index 99865bf..9ec8daf 100644
> --- a/testcases/network/lib6/asapi_04.c
> +++ b/testcases/network/lib6/asapi_04.c
> @@ -75,13 +75,13 @@ struct {
>
> void do_tests(void);
> void setup(void), cleanup(void);
> +int csum_test(char *rhost);
>
> int
> main(int argc, char *argv[])
> {
> char *msg; /* message returned from parse_opts */
> int lc;
> - int fd;
>
> /* Parse standard options given to run the test. */
> msg = parse_opts(argc, argv, 0, 0);
> @@ -191,7 +191,7 @@ struct csent {
>
> #define CSCOUNT (sizeof(cstab)/sizeof(cstab[0]))
>
> -static int recvtprot(int sd, char *packet, int psize)
> +static int recvtprot(int sd, unsigned char *packet, int psize)
> {
> struct tprot *tpt;
> int cc, total, expected;
> @@ -245,7 +245,7 @@ struct ph {
> uint8_t ph_nh;
> } ph;
>
> -static char client(int prot, int sfd)
> +static int client(int prot, int sfd)
> {
> struct tprot *pttp = (struct tprot *)tpbuf;
> struct tprot *prtp = (struct tprot *)rpbuf;
> @@ -269,7 +269,7 @@ static char client(int prot, int sfd)
> }
> for (i=0; i<CSCOUNT; ++i) {
> int offset, len, xlen;
> - int cc, rv, j;
> + int rv;
> unsigned char *p, *pend;
>
> offset = sizeof(struct tprot) + cstab[i].cs_offset;
> @@ -323,7 +323,7 @@ static char client(int prot, int sfd)
> offset, len);
> continue;
> }
> - while (cc = recvtprot(sfd, rpbuf, sizeof(rpbuf))) {
> + while ((cc = recvtprot(sfd, rpbuf, sizeof(rpbuf)))) {
> if (htonl(prtp->tp_pid) == pid &&
> htonl(prtp->tp_seq) == seq)
> break;
> @@ -354,6 +354,7 @@ static char client(int prot, int sfd)
> }
> tst_resm(TPASS, "IPV6_CHECKSUM offset %d len %d", offset, len);
> }
> + return 0;
> }
>
> static int listen_fd, connect_fd;
> @@ -365,7 +366,7 @@ ilistener(void *arg)
> connect_fd = accept(listen_fd, 0, 0);
> close(listen_fd);
> sem_post(&ilsem);
> - return;
> + return NULL;
> }
>
> int
> @@ -373,7 +374,7 @@ isocketpair(int pf, int type, int proto, int fd[2])
> {
> pthread_t thid;
> struct sockaddr_in sin4;
> - int namelen;
> + socklen_t namelen;
>
> /* restrict to PF_INET for now */
> if (pf != PF_INET) {
> @@ -516,6 +517,7 @@ csum_test(char *rhost)
> tv.tv_sec = READ_TIMEOUT;
> tv.tv_usec = 0;
> }
> + return 0;
> }
>
> void
> diff --git a/testcases/network/lib6/asapi_05.c
> b/testcases/network/lib6/asapi_05.c
> index 6777053..adcf067 100644
> --- a/testcases/network/lib6/asapi_05.c
> +++ b/testcases/network/lib6/asapi_05.c
> @@ -102,18 +102,18 @@ struct etent {
> { "icmp6_filter icmp6_filt[0]", EXISTS, ICMP6_H, "icmp6_filter",
> "icmp6_filt[0]", "0", .et_value="4" },
> { "ICMP6_FILTER_WILLPASS", DEFINED, ICMP6_H, "ICMP6_FILTER_WILLPASS",
> - 0, 0, 0 },
> + 0, 0, {0} },
> { "ICMP6_FILTER_WILLBLOCK", DEFINED, ICMP6_H, "ICMP6_FILTER_WILLBLOCK",
> - 0, 0, 0 },
> + 0, 0, {0} },
> { "ICMP6_FILTER_SETPASS", DEFINED, ICMP6_H, "ICMP6_FILTER_SETPASS",
> - 0, 0, 0 },
> + 0, 0, {0} },
> { "ICMP6_FILTER_SETBLOCK", DEFINED, ICMP6_H, "ICMP6_FILTER_SETBLOCK",
> - 0, 0, 0 },
> + 0, 0, {0} },
> { "ICMP6_FILTER_SETPASSALL", DEFINED, ICMP6_H,"ICMP6_FILTER_SETPASSALL",
> - 0, 0, 0 },
> + 0, 0, {0} },
> { "ICMP6_FILTER_SETBLOCKALL",DEFINED,ICMP6_H,"ICMP6_FILTER_SETBLOCKALL",
> - 0, 0, 0 },
> - { "ICMP6_FILTER", DEFINED, ICMP6_H, "ICMP6_FILTER", 0, 0, 0 },
> + 0, 0, {0} },
> + { "ICMP6_FILTER", DEFINED, ICMP6_H, "ICMP6_FILTER", 0, 0, {0} },
> /* existence checks, RFC 3542 section 4 */
> /* socket options */
> { "IPV6_RECVPKTINFO", VALUE, IN_H, "IPV6_RECVPKTINFO", 0, 0,
> @@ -129,14 +129,14 @@ struct etent {
> { "IPV6_RECVTCLASS", VALUE, IN_H, "IPV6_RECVTCLASS", 0, 0,
> .et_dname="IPV6_RECVTCLASS" },
> /* cmsg types */
> - { "IPV6_PKTINFO", DEFINED, IN_H, "IPV6_PKTINFO", 0, 0, 0 },
> - { "IPV6_HOPLIMIT", DEFINED, IN_H, "IPV6_HOPLIMIT", 0, 0, 0},
> - { "IPV6_NEXTHOP", DEFINED, IN_H, "IPV6_NEXTHOP", 0, 0, 0},
> - { "IPV6_RTHDR", DEFINED, IN_H, "IPV6_RTHDR", 0, 0, 0 },
> - { "IPV6_HOPOPTS", DEFINED, IN_H, "IPV6_HOPOPTS", 0, 0, 0 },
> - { "IPV6_DSTOPTS", DEFINED, IN_H, "IPV6_DSTOPTS", 0, 0, 0 },
> - { "IPV6_RTHDRDSTOPTS", DEFINED, IN_H, "IPV6_RTHDRDSTOPTS", 0, 0, 0},
> - { "IPV6_TCLASS", DEFINED, IN_H, "IPV6_TCLASS", 0, 0, 0 },
> + { "IPV6_PKTINFO", DEFINED, IN_H, "IPV6_PKTINFO", 0, 0, {0} },
> + { "IPV6_HOPLIMIT", DEFINED, IN_H, "IPV6_HOPLIMIT", 0, 0, {0} },
> + { "IPV6_NEXTHOP", DEFINED, IN_H, "IPV6_NEXTHOP", 0, 0, {0} },
> + { "IPV6_RTHDR", DEFINED, IN_H, "IPV6_RTHDR", 0, 0, {0} },
> + { "IPV6_HOPOPTS", DEFINED, IN_H, "IPV6_HOPOPTS", 0, 0, {0} },
> + { "IPV6_DSTOPTS", DEFINED, IN_H, "IPV6_DSTOPTS", 0, 0, {0} },
> + { "IPV6_RTHDRDSTOPTS", DEFINED, IN_H, "IPV6_RTHDRDSTOPTS", 0, 0, {0} },
> + { "IPV6_TCLASS", DEFINED, IN_H, "IPV6_TCLASS", 0, 0, {0} },
> };
>
> #define ETCOUNT (sizeof(etab)/sizeof(etab[0]))
> diff --git a/testcases/network/lib6/asapi_06.c
> b/testcases/network/lib6/asapi_06.c
> index ad0cdae..418dfc0 100644
> --- a/testcases/network/lib6/asapi_06.c
> +++ b/testcases/network/lib6/asapi_06.c
> @@ -50,6 +50,7 @@
> #include <net/if.h>
> #include <sys/ioctl.h>
> #include <ifaddrs.h>
> +#include <arpa/inet.h>
>
> #include "test.h"
> #include "usctest.h"
> @@ -78,7 +79,6 @@ main(int argc, char *argv[])
> {
> char *msg; /* message returned from parse_opts */
> int lc;
> - int fd;
>
> /* Parse standard options given to run the test. */
> msg = parse_opts(argc, argv, 0, 0);
> @@ -231,12 +231,12 @@ struct cme {
>
> #define CMCOUNT (sizeof(cmtab)/sizeof(cmtab[0]))
>
> +ssize_t
> sendall(int st)
> {
> struct sockaddr_in6 sin6;
> struct msghdr msg;
> struct iovec iov;
> - struct cmsghdr *pcmsg;
> struct soprot *psop;
> unsigned char *pd;
> int i, ctotal;
> @@ -280,9 +280,7 @@ void
> so_test(struct soent *psoe)
> {
> struct sockaddr_in6 sin6;
> - struct soprot *psop;
> union soval sobuf;
> - int onoff;
> socklen_t valsize;
> static int sr = -1;
> int st;
> diff --git a/testcases/network/lib6/asapi_07.c
> b/testcases/network/lib6/asapi_07.c
> index 18e21fe..5cf1d8e 100644
> --- a/testcases/network/lib6/asapi_07.c
> +++ b/testcases/network/lib6/asapi_07.c
> @@ -116,11 +116,11 @@ struct etent {
> "cmsg_level", 0, .et_value="sizeof(int)"},
> { "cmsghdr cmsg_type", EXISTS, SOCKET_H, "cmsghdr",
> "cmsg_type", 0, .et_value="sizeof(int)"},
> - { "CMSG_DATA", DEFINED, SOCKET_H, "CMSG_DATA", 0, 0, 0},
> - { "CMSG_NXTHDR", DEFINED, SOCKET_H, "CMSG_NXTHDR", 0, 0, 0},
> - { "CMSG_FIRSTHDR", DEFINED, SOCKET_H, "CMSG_FIRSTHDR", 0, 0, 0},
> - { "CMSG_SPACE", DEFINED, SOCKET_H, "CMSG_SPACE", 0, 0, 0},
> - { "CMSG_LEN", DEFINED, SOCKET_H, "CMSG_LEN", 0, 0, 0},
> + { "CMSG_DATA", DEFINED, SOCKET_H, "CMSG_DATA", 0, 0, {0}},
> + { "CMSG_NXTHDR", DEFINED, SOCKET_H, "CMSG_NXTHDR", 0, 0, {0}},
> + { "CMSG_FIRSTHDR", DEFINED, SOCKET_H, "CMSG_FIRSTHDR", 0, 0, {0}},
> + { "CMSG_SPACE", DEFINED, SOCKET_H, "CMSG_SPACE", 0, 0, {0}},
> + { "CMSG_LEN", DEFINED, SOCKET_H, "CMSG_LEN", 0, 0, {0}},
> };
>
> #define ETCOUNT (sizeof(etab)/sizeof(etab[0]))
> diff --git a/testcases/network/lib6/getaddrinfo_01.c
> b/testcases/network/lib6/getaddrinfo_01.c
> index 9433bed..919bf93 100644
> --- a/testcases/network/lib6/getaddrinfo_01.c
> +++ b/testcases/network/lib6/getaddrinfo_01.c
> @@ -45,6 +45,7 @@
>
> #include <sys/socket.h>
> #include <netdb.h>
> +#include <arpa/inet.h>
>
> #include "test.h"
> #include "usctest.h"
> @@ -916,7 +917,7 @@ dumpres(struct addrinfo *pai)
> {
> int count = 1;
> for (; pai; pai = pai->ai_next, count++) {
> - printf("result %d [0x%08X]\n", count, pai);
> + printf("result %d [0x%p]\n", count, pai);
> printf("\tai_flags %x\n", pai->ai_flags);
> printf("\tai_family %d\n", pai->ai_family);
> printf("\tai_socktype %d\n", pai->ai_socktype);
> @@ -944,7 +945,7 @@ dumpres(struct addrinfo *pai)
> printf("\tai_addr.sin6_addr \"%s\"\n", buf);
>
> }
> - printf("\tai_next %X\n", pai->ai_next);
> + printf("\tai_next %p\n", pai->ai_next);
> }
> }
>
> diff --git a/testcases/network/lib6/in6_01.c b/testcases/network/lib6/in6_01.c
> index 1d4f18d..e8da92a 100644
> --- a/testcases/network/lib6/in6_01.c
> +++ b/testcases/network/lib6/in6_01.c
> @@ -40,6 +40,7 @@
> #include <errno.h>
>
> #include <netinet/in.h>
> +#include <arpa/inet.h>
>
> #include "test.h"
> #include "usctest.h"
> @@ -82,7 +83,6 @@ main(int argc, char *argv[])
> uint8_t ui8 = 1;
> uint32_t ui16 = 2;
> uint32_t ui32 = 3;
> - uint64_t ui64 = 4;
> struct in6_addr in6;
> struct in6_addr ina6 = IN6ADDR_ANY_INIT;
> struct in6_addr inl6 = IN6ADDR_LOOPBACK_INIT;
> diff --git a/testcases/network/lib6/in6_02.c b/testcases/network/lib6/in6_02.c
> index 4eeb75b..3f68ee0 100644
> --- a/testcases/network/lib6/in6_02.c
> +++ b/testcases/network/lib6/in6_02.c
> @@ -146,7 +146,7 @@ i2ntest1(unsigned int if_index)
> char ifname[IF_NAMESIZE];
> unsigned int idx;
>
> - TEST(if_indextoname(if_index, ifname));
> + TEST((ifname == if_indextoname(if_index, ifname)));
> if (!TEST_RETURN) {
> if (TEST_ERRNO != ENXIO) {
> tst_resm(TFAIL, "if_indextoname(%d) returns %d "
> diff --git a/testcases/network/lib6/runcc.c b/testcases/network/lib6/runcc.c
> index 8f2f788..b0fe642 100644
> --- a/testcases/network/lib6/runcc.c
> +++ b/testcases/network/lib6/runcc.c
> @@ -31,6 +31,7 @@
> #include <stdio.h>
> #include <unistd.h>
> #include <errno.h>
> +#include <ctype.h>
>
> #include <sys/wait.h>
>
> @@ -102,7 +103,7 @@ runcc(char *tname, char *filename0, char *program)
>
> if (WEXITSTATUS(es)) {
> tst_resm(TFAIL, "%s: not present", tname);
> - return;
> + return -1;
> }
> /* run the test */
>
> @@ -151,7 +152,8 @@ structcheck(char *tname, char *incl, char *structure,
> char *field,
> sprintf(program, stmpl, incl, structure, fieldref);
> snprintf(filename, sizeof(filename), filetmpl, strfpn(structure),
> structure);
> - runcc(tname, filename, program);
> + rv = runcc(tname, filename, program);
> + return rv;
> }
>
> char *aliasfmt = "exit(&tst.%s != &tst.%s || sizeof(tst.%s) !=
> sizeof(tst.%s));";
> @@ -166,7 +168,8 @@ aliascheck(char *tname, char *incl, char *structure, char
> *field, char *dname)
> sprintf(program, stmpl, incl, structure, fieldref);
> snprintf(filename, sizeof(filename), filetmpl, strfpn(structure),
> structure);
> - runcc(tname, filename, program);
> + rv = runcc(tname, filename, program);
> + return rv;
> }
>
> const char *dtmpl =
> @@ -180,7 +183,8 @@ valuecheck(char *tname, char *incl, char *dname, char
> *dval)
>
> sprintf(program, dtmpl, incl, dname, dval);
> snprintf(filename, sizeof(filename), filetmpl, strfpn(dname), dname);
> - runcc(tname, filename, program);
> + rv = runcc(tname, filename, program);
> + return rv;
> }
>
> const char *ftmpl =
> @@ -195,5 +199,6 @@ funccheck(char *tname, char *incl, char *fname)
>
> sprintf(program, ftmpl, incl, fname);
> snprintf(filename, sizeof(filename), filetmpl, strfpn(fname), fname);
> - runcc(tname, filename, program);
> + rv = runcc(tname, filename, program);
> + return rv;
> }
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list