From: Jonathan Rajotte Date: Thu, 4 Jul 2019 20:02:13 +0000 (-0400) Subject: Fix: do not use diagnostic pragma when GCC version is lower than 4.6.0 X-Git-Tag: v2.12.0-pre~36 X-Git-Url: http://git.liburcu.org/?p=lttng-modules.git;a=commitdiff_plain;h=4ea9b7c98ade603b08f0d945f4d99bc079eb57b6 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 Signed-off-by: Jonathan Rajotte Signed-off-by: Mathieu Desnoyers --- diff --git a/lib/bitfield.h b/lib/bitfield.h index ebbe7544..a9e268b4 100644 --- a/lib/bitfield.h +++ b/lib/bitfield.h @@ -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")