aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2025-03-22 21:01:32 -0700
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2025-06-02 07:27:40 +0200
commitac0ab65ebcd7b11739986b81343457469fbb43b0 (patch)
treec376d2903d3f70323c21d30cf81e77fec4800133
parent2ff8105b3bb2d8eff682bbbfdca1a7843c7bd524 (diff)
Improve check for GCC compiler version
When using unreleased compiler has version like 15.0.1 and that test fails because __GNUC_MINOR__ < 1 becomes true, therefore check for full version string which is more rubust. Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--ubifs-utils/common/atomic.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/ubifs-utils/common/atomic.h b/ubifs-utils/common/atomic.h
index f287d43..95754b2 100644
--- a/ubifs-utils/common/atomic.h
+++ b/ubifs-utils/common/atomic.h
@@ -2,8 +2,12 @@
#ifndef __ATOMIC_H__
#define __ATOMIC_H__
+#define GCC_VERSION (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+
/* Check GCC version, just to be safe */
-#if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC_MINOR__ < 1)
+#if GCC_VERSION < 40100
# error atomic.h works only with GCC newer than version 4.1
#endif /* GNUC >= 4.1 */