[sysprof] macros: add helper to check for gcc version



commit 50d33452abfdd4761ebf949d58b88ef78c5c1fe5
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jul 4 16:11:06 2020 -0700

    macros: add helper to check for gcc version

 src/libsysprof-capture/sysprof-macros.h | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/libsysprof-capture/sysprof-macros.h b/src/libsysprof-capture/sysprof-macros.h
index be2afc1..f025458 100644
--- a/src/libsysprof-capture/sysprof-macros.h
+++ b/src/libsysprof-capture/sysprof-macros.h
@@ -61,6 +61,15 @@
 
 #include <limits.h>
 
+#ifdef __GNUC__
+#define SYSPROF_GNUC_CHECK_VERSION(major, minor) \
+    ((__GNUC__ > (major)) || \
+     ((__GNUC__ == (major)) && \
+      (__GNUC_MINOR__ >= (minor))))
+#else
+#define SYSPROF_GNUC_CHECK_VERSION(major, minor) 0
+#endif
+
 #if INT_MAX == LONG_MAX
 #define SYSPROF_INT64_CONSTANT(x) x##ULL
 #define SYSPROF_UINT64_CONSTANT(x) x##LL


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]