Skip to content
  • Stefan Weil's avatar
    0448f5f8
    cpu-exec: Fix compiler warning (-Werror=clobbered) · 0448f5f8
    Stefan Weil authored
    
    
    Reloading of local variables after sigsetjmp is only needed for some
    buggy compilers.
    
    The code which should reload these variables causes compiler warnings
    with gcc 4.7 when compiler optimizations are enabled:
    
    cpu-exec.c:204:15: error:
     variable ‘cpu’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
    cpu-exec.c:207:15: error:
     variable ‘cc’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
    cpu-exec.c:202:28: error:
     argument ‘env’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
    
    Now this code is only used for compilers which need it
    (and gcc 4.5.x, x > 0 which does not need it but won't give warnings).
    
    There were bug reports for clang and gcc 4.5.0, while gcc 4.5.1
    was reported to work fine without the reload code. For clang it
    is not clear which versions are affected, so simply keep the status quo
    for all clang compilations. This can be improved later.
    
    Signed-off-by: default avatarStefan Weil <sw@weilnetz.de>
    Message-Id: <1443266606-21400-1-git-send-email-sw@weilnetz.de>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    0448f5f8
    cpu-exec: Fix compiler warning (-Werror=clobbered)
    Stefan Weil authored
    
    
    Reloading of local variables after sigsetjmp is only needed for some
    buggy compilers.
    
    The code which should reload these variables causes compiler warnings
    with gcc 4.7 when compiler optimizations are enabled:
    
    cpu-exec.c:204:15: error:
     variable ‘cpu’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
    cpu-exec.c:207:15: error:
     variable ‘cc’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
    cpu-exec.c:202:28: error:
     argument ‘env’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
    
    Now this code is only used for compilers which need it
    (and gcc 4.5.x, x > 0 which does not need it but won't give warnings).
    
    There were bug reports for clang and gcc 4.5.0, while gcc 4.5.1
    was reported to work fine without the reload code. For clang it
    is not clear which versions are affected, so simply keep the status quo
    for all clang compilations. This can be improved later.
    
    Signed-off-by: default avatarStefan Weil <sw@weilnetz.de>
    Message-Id: <1443266606-21400-1-git-send-email-sw@weilnetz.de>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Loading