Skip to contentSkip to conversation

Fix: do not use diagnostic pragma when GCC version is lower than 4.6.0

PATCH New Jonathan Rajotte 2 participants 2 messages Jul 4, 2019 1 message not in the archive Library code

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/2 Fix: do not use diagnostic pragma when GCC version is lower than 4.6.0

Officially the diagnostic pragma are supported starting in 4.6. [1] But they were present before 4.6 with limitation which we cannot honour easily.

[1] https://gcc.gnu.org/gcc-4.6/changes.html

---
 lib/bitfield.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/bitfield.h +3 -1
index ebbe754..a9e268b 100644
@@ -29,8 +29,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")
 
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH lttng-modules 1/2] Fix: missing define when not building with gcc

In reply to a message not in the archive

Both merged into master, 2.11, 2.10, 2.9, thanks!

Mathieu

Quoted 19 lines · ----- On Jul 4, 2019, at 4:02 PM, Jonathan Rajotte…

---
lib/bitfield.h | 1 +

1 file changed, 1 insertion(+)
lib/bitfield.h +1 -1
index 2f7c01d..ebbe754 100644
@@ -44,6 +44,7 @@
 # define _BT_DIAG_PUSH
 # define _BT_DIAG_POP
 # define _BT_DIAG_IGNORE
+# define _BT_DIAG_IGNORE_TYPE_LIMITS
 #endif
 
 #define _bt_is_signed_type(type)	((type) -1 < (type) 0)
--

2.17.1

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com