about summary refs log tree commit diff
path: root/setjmp
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-11-26 00:45:19 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-11-26 00:45:19 +0000
commitc82f5c0ce5c1c0180fca311ceb29fd2d59da7441 (patch)
treea6365743912e255a581211460da20a88f1cfd97f /setjmp
parent439e1ad6d04e24f76f92ff7f61153fbe489559b9 (diff)
downloadglibc-c82f5c0ce5c1c0180fca311ceb29fd2d59da7441.tar.gz
glibc-c82f5c0ce5c1c0180fca311ceb29fd2d59da7441.tar.xz
glibc-c82f5c0ce5c1c0180fca311ceb29fd2d59da7441.zip
Fix warning in setjmp/jmpbug.c.
This patch fixes a "set but not used" warning in setjmp/jmpbug.c.  A
variable is used only to store the result of alloca.  A cast to void
is added to avoid the warning, and the variable is made volatile to
ensure the call to alloca isn't optimized away for being unused.

Tested for x86_64.

	* setjmp/jmpbug.c (test): Make foo volatile and cast it to
	void.
Diffstat (limited to 'setjmp')
-rw-r--r--setjmp/jmpbug.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/setjmp/jmpbug.c b/setjmp/jmpbug.c
index 125977b2f7..8594c5a8a7 100644
--- a/setjmp/jmpbug.c
+++ b/setjmp/jmpbug.c
@@ -14,7 +14,7 @@ static void
 test (int x)
 {
   jmp_buf buf;
-  char *foo;
+  char *volatile foo;
   int arr[100];
 
   arr[77] = x;
@@ -25,6 +25,7 @@ test (int x)
     }
 
   foo = (char *) alloca (128);
+  (void) foo;
   sub5 (buf);
 }