From: Joey Adams Date: Sun, 29 May 2011 02:23:55 +0000 (-0400) Subject: cast, container_of, tlist: Fix warning with GCC 4.6: -Wunused-but-set-variable X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=f27c9672ef62379e09793dcf42725bf9c37f44bf cast, container_of, tlist: Fix warning with GCC 4.6: -Wunused-but-set-variable --- diff --git a/ccan/cast/test/compile_fail-cast_const.c b/ccan/cast/test/compile_fail-cast_const.c index d401cc8c..277f3de1 100644 --- a/ccan/cast/test/compile_fail-cast_const.c +++ b/ccan/cast/test/compile_fail-cast_const.c @@ -18,6 +18,7 @@ int main(int argc, char *argv[]) *p = NULL; uc = cast_const(char *, p); + (void) uc; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/cast/test/compile_fail-cast_const2.c b/ccan/cast/test/compile_fail-cast_const2.c index a16cfacf..e671e88e 100644 --- a/ccan/cast/test/compile_fail-cast_const2.c +++ b/ccan/cast/test/compile_fail-cast_const2.c @@ -18,6 +18,7 @@ int main(int argc, char *argv[]) **p = NULL; uc = cast_const2(char **, p); + (void) uc; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/cast/test/compile_fail-cast_const3.c b/ccan/cast/test/compile_fail-cast_const3.c index f782f9d9..e958e2dd 100644 --- a/ccan/cast/test/compile_fail-cast_const3.c +++ b/ccan/cast/test/compile_fail-cast_const3.c @@ -18,6 +18,7 @@ int main(int argc, char *argv[]) ***p = NULL; uc = cast_const3(char ***, p); + (void) uc; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/cast/test/compile_fail-cast_signed-const.c b/ccan/cast/test/compile_fail-cast_signed-const.c index 791d9b84..9971dc8e 100644 --- a/ccan/cast/test/compile_fail-cast_signed-const.c +++ b/ccan/cast/test/compile_fail-cast_signed-const.c @@ -11,6 +11,7 @@ int main(int argc, char *argv[]) *p = NULL; uc = cast_signed(unsigned char *, p); + (void) uc; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/cast/test/compile_fail-cast_signed-sizesame.c b/ccan/cast/test/compile_fail-cast_signed-sizesame.c index 87da7216..2bc40b2f 100644 --- a/ccan/cast/test/compile_fail-cast_signed-sizesame.c +++ b/ccan/cast/test/compile_fail-cast_signed-sizesame.c @@ -18,6 +18,7 @@ int main(int argc, char *argv[]) uc = cast_signed(unsigned char *, p); + (void) uc; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/cast/test/compile_fail-cast_signed.c b/ccan/cast/test/compile_fail-cast_signed.c index 5b182ab5..66bcc0a1 100644 --- a/ccan/cast/test/compile_fail-cast_signed.c +++ b/ccan/cast/test/compile_fail-cast_signed.c @@ -12,5 +12,6 @@ int main(int argc, char *argv[]) *p = NULL; uc = cast_signed(unsigned char *, p); + (void) uc; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/cast/test/compile_fail-cast_static-2.c b/ccan/cast/test/compile_fail-cast_static-2.c index d3ba8d3e..8a120253 100644 --- a/ccan/cast/test/compile_fail-cast_static-2.c +++ b/ccan/cast/test/compile_fail-cast_static-2.c @@ -12,6 +12,7 @@ int main(int argc, char *argv[]) *p = 0; c = cast_static(char *, p); + (void) c; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/cast/test/compile_fail-cast_static-3.c b/ccan/cast/test/compile_fail-cast_static-3.c index 1625f545..6296b752 100644 --- a/ccan/cast/test/compile_fail-cast_static-3.c +++ b/ccan/cast/test/compile_fail-cast_static-3.c @@ -10,6 +10,7 @@ int main(int argc, char *argv[]) char *p = 0; c = cast_static(char *, p); + (void) c; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/cast/test/compile_fail-cast_static.c b/ccan/cast/test/compile_fail-cast_static.c index 51ea8c2d..0f9e4780 100644 --- a/ccan/cast/test/compile_fail-cast_static.c +++ b/ccan/cast/test/compile_fail-cast_static.c @@ -12,5 +12,6 @@ int main(int argc, char *argv[]) x = 0; c = cast_static(char, x); + (void) c; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/container_of/test/compile_fail-types.c b/ccan/container_of/test/compile_fail-types.c index a50b11c2..cae1c7ab 100644 --- a/ccan/container_of/test/compile_fail-types.c +++ b/ccan/container_of/test/compile_fail-types.c @@ -17,5 +17,6 @@ int main(int argc, char *argv[]) #else foop = NULL; #endif + (void) foop; /* Suppress unused-but-set-variable warning. */ return intp == NULL; } diff --git a/ccan/container_of/test/compile_fail-var-types.c b/ccan/container_of/test/compile_fail-var-types.c index b7f395c7..f254d921 100644 --- a/ccan/container_of/test/compile_fail-var-types.c +++ b/ccan/container_of/test/compile_fail-var-types.c @@ -20,5 +20,6 @@ int main(int argc, char *argv[]) #else foop = NULL; #endif + (void) foop; /* Suppress unused-but-set-variable warning. */ return intp == NULL; } diff --git a/ccan/tlist/test/compile_fail-tlist_for_each.c b/ccan/tlist/test/compile_fail-tlist_for_each.c index e2a267b8..1b2fb688 100644 --- a/ccan/tlist/test/compile_fail-tlist_for_each.c +++ b/ccan/tlist/test/compile_fail-tlist_for_each.c @@ -28,6 +28,7 @@ int main(int argc, char *argv[]) tlist_init(&children); tlist_add(&children, &child, list); - tlist_for_each(&children, c, list); + tlist_for_each(&children, c, list) + (void) c; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/tlist/test/compile_fail-tlist_tail.c b/ccan/tlist/test/compile_fail-tlist_tail.c index ab43ae90..0a9dabac 100644 --- a/ccan/tlist/test/compile_fail-tlist_tail.c +++ b/ccan/tlist/test/compile_fail-tlist_tail.c @@ -31,5 +31,6 @@ int main(int argc, char *argv[]) struct child, #endif list); + (void) c; /* Suppress unused-but-set-variable warning. */ return 0; } diff --git a/ccan/tlist/test/compile_fail-tlist_top.c b/ccan/tlist/test/compile_fail-tlist_top.c index 622a5781..d02c3add 100644 --- a/ccan/tlist/test/compile_fail-tlist_top.c +++ b/ccan/tlist/test/compile_fail-tlist_top.c @@ -31,5 +31,6 @@ int main(int argc, char *argv[]) struct child, #endif list); + (void) c; /* Suppress unused-but-set-variable warning. */ return 0; }