Building on a SLES11 SP4.
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973
bison (GNU Bison) 2.4
autoconf (GNU Autoconf) 2.69
automake (GNU automake) 1.15
GNU Make 3.81
The same would probably happen if using RHEL6 and its default compiler
since it uses GCC 4.4 [1].
The README suggest that we support GCC > 3.2.
Officially the diagnostic pragma are supported starting in 4.6. [2]
But they were present before 4.6 with limitation.
Error encountered:
integer.c: In function 'ctf_integer_read':
integer.c:271: error: #pragma GCC diagnostic not allowed inside functions
integer.c:271: error: #pragma GCC diagnostic not allowed inside functions
integer.c:271: error: #pragma GCC diagnostic not allowed inside functions
integer.c:276: error: #pragma GCC diagnostic not allowed inside functions
integer.c:276: error: #pragma GCC diagnostic not allowed inside functions
integer.c:276: error: #pragma GCC diagnostic not allowed inside functions
integer.c:282: error: #pragma GCC diagnostic not allowed inside functions
integer.c:282: error: #pragma GCC diagnostic not allowed inside functions
integer.c:282: error: #pragma GCC diagnostic not allowed inside functions
integer.c:287: error: #pragma GCC diagnostic not allowed inside functions
integer.c:287: error: #pragma GCC diagnostic not allowed inside functions
integer.c:287: error: #pragma GCC diagnostic not allowed inside functions
[1] https://access.redhat.com/solutions/19458
[2] https://gcc.gnu.org/gcc-4.6/changes.html
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Ie6e4e8bd631f7aab1435fece929621c9a11990e4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1630
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
/*
* _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")