[ovs-dev] [PATCH] ovs-atomic: __GNUC__ == 4 is enough

Linhaifeng haifeng.lin at huawei.com
Sat Sep 19 06:08:47 UTC 2020


1. include config.h to avoid include different atomic head file
2. __GNUC__ == 4 is enough

Fixes: 31a3fc6e3e9c ("ovs-atomic: New library for atomic operations.")
Cc: blp at nicira.com

Signed-off-by: Linhaifeng <haifeng.lin at huawei.com>
---
 lib/ovs-atomic.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ovs-atomic.h b/lib/ovs-atomic.h
index 11fa19268..2aee4c608 100644
--- a/lib/ovs-atomic.h
+++ b/lib/ovs-atomic.h
@@ -311,6 +311,7 @@
  *         memory_order_seq_cst for atomic_flag_clear()).
  */
 
+#include <config.h>
 #include <limits.h>
 #include <pthread.h>
 #include <stdbool.h>
@@ -331,7 +332,7 @@
         #include "ovs-atomic-c11.h"
     #elif __GNUC__ >= 5 && !defined(__cplusplus)
         #error "GCC 5+ should have <stdatomic.h>"
-    #elif __GNUC__ >= 5 || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 7)
+    #elif __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
         #include "ovs-atomic-gcc4.7+.h"
     #elif __GNUC__ && defined(__x86_64__)
         #include "ovs-atomic-x86_64.h"
-- 
2.21.0.windows.1


More information about the dev mailing list