Patchwork [10/12] qemu-barrier: Fix compiler version check for future gcc versions

login
register
mail settings
Submitter Stefan Hajnoczi
Date Oct. 5, 2012, 2 p.m.
Message ID <1349445632-23674-11-git-send-email-stefanha@gmail.com>
Download mbox | patch
Permalink /patch/189497/
State New
Headers show

Comments

Stefan Hajnoczi - Oct. 5, 2012, 2 p.m.
From: Stefan Weil <sw@weilnetz.de>

The current check will give a wrong result for gcc-5.x with x < 4.
Using QEMU_GNUC_PREREQ is simpler and fixes that issue.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
---
 qemu-barrier.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/qemu-barrier.h b/qemu-barrier.h
index 7e11197..16f0942 100644
--- a/qemu-barrier.h
+++ b/qemu-barrier.h
@@ -19,7 +19,7 @@ 
  * mfence on 32 bit as well, e.g. if built with -march=pentium-m.
  * However, on i386, there seem to be known bugs as recently as 4.3.
  * */
-#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 4
+#if QEMU_GNUC_PREREQ(4, 4)
 #define smp_mb() __sync_synchronize()
 #else
 #define smp_mb() asm volatile("lock; addl $0,0(%%esp) " ::: "memory")