Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/ccfbfdaf316506c9b378427d2bc5b19b67a1c0b4

>---------------------------------------------------------------

commit ccfbfdaf316506c9b378427d2bc5b19b67a1c0b4
Author: Simon Marlow <[email protected]>
Date:   Fri Nov 18 14:59:49 2011 +0000

    fix new warnings with gcc 4.6

>---------------------------------------------------------------

 rts/Linker.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/rts/Linker.c b/rts/Linker.c
index f5b90d4..4319041 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -4206,18 +4206,24 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
 {
    int j;
    char *symbol = NULL;
-   Elf_Addr targ;
    Elf_Rela* rtab = (Elf_Rela*) (ehdrC + shdr[shnum].sh_offset);
    Elf_Sym*  stab;
    char*     strtab;
    int         nent = shdr[shnum].sh_size / sizeof(Elf_Rela);
-   int target_shndx = shdr[shnum].sh_info;
    int symtab_shndx = shdr[shnum].sh_link;
    int strtab_shndx = shdr[symtab_shndx].sh_link;
+#if defined(DEBUG) || defined(sparc_HOST_ARCH) || defined(ia64_HOST_ARCH) || 
defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
+   /* This #ifdef only serves to avoid unused-var warnings. */
+   Elf_Addr targ;
+   int target_shndx = shdr[shnum].sh_info;
+#endif
 
    stab  = (Elf_Sym*) (ehdrC + shdr[ symtab_shndx ].sh_offset);
    strtab= (char*)    (ehdrC + shdr[ strtab_shndx ].sh_offset);
+#if defined(DEBUG) || defined(sparc_HOST_ARCH) || defined(ia64_HOST_ARCH) || 
defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
+   /* This #ifdef only serves to avoid set-but-not-used warnings */
    targ  = (Elf_Addr) (ehdrC + shdr[ target_shndx ].sh_offset);
+#endif
    IF_DEBUG(linker,debugBelch( "relocations for section %d using symtab %d\n",
                           target_shndx, symtab_shndx ));
 
@@ -4226,12 +4232,14 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
       /* This #ifdef only serves to avoid unused-var warnings. */
       Elf_Addr  offset = rtab[j].r_offset;
       Elf_Addr  P      = targ + offset;
+      Elf_Addr  A      = rtab[j].r_addend;
+#endif
+#if defined(sparc_HOST_ARCH) || defined(ia64_HOST_ARCH) || 
defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
+      Elf_Addr  value;
 #endif
       Elf_Addr  info   = rtab[j].r_info;
-      Elf_Addr  A      = rtab[j].r_addend;
       Elf_Addr  S;
       void*     S_tmp;
-      Elf_Addr  value;
 #     if defined(sparc_HOST_ARCH)
       Elf_Word* pP = (Elf_Word*)P;
       Elf_Word  w1, w2;
@@ -4286,7 +4294,9 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
                                         (void*)P, (void*)S, (void*)A ));
       /* checkProddableBlock ( oc, (void*)P ); */
 
+#if defined(sparc_HOST_ARCH) || defined(ia64_HOST_ARCH) || 
defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
       value = S + A;
+#endif
 
       switch (ELF_R_TYPE(info)) {
 #        if defined(sparc_HOST_ARCH)



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to