[lttng-ust,2/2] Fix: do not use diagnostic pragma when GCC version is lower than 4.6.0
diff mbox series

Message ID 20190704185137.24943-2-jonathan.rajotte-julien@efficios.com
State New
Headers show
Series
  • [lttng-ust,1/2] Fix: missing define when not building with gcc
Related show

Commit Message

Jonathan Rajotte July 4, 2019, 6:51 p.m. UTC
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
 include/lttng/bitfield.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/include/lttng/bitfield.h b/include/lttng/bitfield.h
index 92f1c2c9..5ed62938 100644
--- a/include/lttng/bitfield.h
+++ b/include/lttng/bitfield.h
@@ -44,8 +44,10 @@ 
 /*
  * _bt_is_signed_type() willingly generates comparison of unsigned
  * expression < 0, which is always false. Silence compiler warnings.
+ * GCC versions lower than 4.6.0 do not accept diagnostic pragma inside
+ * functions.
  */
-#ifdef __GNUC__
+#if defined (__GNUC__) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
 # define _BT_DIAG_PUSH			_Pragma("GCC diagnostic push")
 # define _BT_DIAG_POP			_Pragma("GCC diagnostic pop")