This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch] Fix two false testcase failures (unused variables)
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: binutils at sourceware dot org
- Date: Tue, 16 Sep 2008 16:10:03 +0200
- Subject: [patch] Fix two false testcase failures (unused variables)
Hi,
on Fedora gcc-4.3.2-3.x86_64 getting two false testsuite failures, is the
attached patch OK?
Running /home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-elfcomm/elfcomm.exp ...
...
Executing on host: sh -c {gcc -B/home/jkratoch/redhat/binutils-cvs/ld/tmpdir/gas/ -I/home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-elfcomm -m64 -ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -L/home/jkratoch/redhat/binutils-cvs/./ld -m64 -ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -c /home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-elfcomm/common1b.c -o tmpdir/common1b.o 2>&1} /dev/null ld.tmp (timeout = 300)
/home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-elfcomm/common1b.c:1: warning: 'dummy1' defined but not used
/home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-elfcomm/common1b.c:1: warning: 'dummy1' defined but not used
ERROR: /home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-elfcomm/common1b.c: compilation failed
UNRESOLVED: size/aligment change of common symbols
Running /home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-shared/shared.exp ...
...
Executing on host: sh -c {gcc -B/home/jkratoch/redhat/binutils-cvs/ld/tmpdir/gas/ -I/home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-shared -m64 -ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -L/home/jkratoch/redhat/binutils-cvs/./ld -m64 -ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DSYMBOLIC_TEST -DXCOFF_TEST -c /home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-shared/main.c -o tmpdir/mainnp.o 2>&1} /dev/null ld.tmp (timeout = 300)
/home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-shared/main.c: In function 'main':
/home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-shared/main.c:41: warning: unused variable 'p'
/home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-shared/main.c: In function 'main':
/home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-shared/main.c:41: warning: unused variable 'p'
ERROR: /home/jkratoch/redhat/binutils-cvs/ld/testsuite/ld-shared/main.c: compilation failed
UNRESOLVED: shared -Bsymbolic
Thanks,
Jan
2008-09-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix testcases compilation failures due to unused variables.
* ld-elfcomm/common1b.c (dummy1): Mark the variable for GCC as USED.
* ld-shared/main.c (main): Move the P variable only to the places where
it is used.
--- ld/testsuite/ld-elfcomm/common1b.c 15 Apr 2003 09:38:10 -0000 1.1
+++ ld/testsuite/ld-elfcomm/common1b.c 16 Sep 2008 13:51:26 -0000
@@ -1,3 +1,7 @@
-static char dummy1 = 'X';
+static
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
+ __attribute__((__used__))
+#endif /* !__GNUC__ */
+ char dummy1 = 'X';
char foo1 [] = "Aligned at odd byte.";
char foo2 [4];
--- ld/testsuite/ld-shared/main.c 6 Jun 2001 21:03:59 -0000 1.3
+++ ld/testsuite/ld-shared/main.c 16 Sep 2008 13:51:27 -0000
@@ -38,8 +38,6 @@ shlib_overriddencall2 ()
int
main ()
{
- int (*p) ();
-
printf ("mainvar == %d\n", mainvar);
printf ("overriddenvar == %d\n", overriddenvar);
printf ("shlibvar1 == %d\n", shlibvar1);
@@ -62,21 +60,29 @@ main ()
printf ("shlib_checkfunptr2 (main_called) == %d\n",
shlib_checkfunptr2 (main_called));
#endif
- p = shlib_getfunptr1 ();
- printf ("shlib_getfunptr1 () ");
- if (p == shlib_shlibvar1)
- printf ("==");
- else
- printf ("!=");
- printf (" shlib_shlibvar1\n");
+ {
+ int (*p) ();
+
+ p = shlib_getfunptr1 ();
+ printf ("shlib_getfunptr1 () ");
+ if (p == shlib_shlibvar1)
+ printf ("==");
+ else
+ printf ("!=");
+ printf (" shlib_shlibvar1\n");
+ }
#ifndef XCOFF_TEST
- p = shlib_getfunptr2 ();
- printf ("shlib_getfunptr2 () ");
- if (p == main_called)
- printf ("==");
- else
- printf ("!=");
- printf (" main_called\n");
+ {
+ int (*p) ();
+
+ p = shlib_getfunptr2 ();
+ printf ("shlib_getfunptr2 () ");
+ if (p == main_called)
+ printf ("==");
+ else
+ printf ("!=");
+ printf (" main_called\n");
+ }
#endif
#endif
printf ("shlib_check () == %d\n", shlib_check ());