1 |
dnl Christian Schoenebeck 2016-10-31 |
2 |
dnl -------------------------------------------------------------------------- |
3 |
dnl |
4 |
dnl Synopsis: |
5 |
dnl |
6 |
dnl ACX_CXX_PRAGMA_DIAGNOSTICS |
7 |
dnl |
8 |
dnl Check the compiler for supported pragma diagnostics capablities. |
9 |
dnl It takes no arguments. |
10 |
dnl |
11 |
dnl At the moment this configure check only checks whether the compiler |
12 |
dnl supports embedding pragma diagnostic statements between parts of |
13 |
dnl statements. |
14 |
dnl |
15 |
dnl -------------------------------------------------------------------------- |
16 |
AC_DEFUN([ACX_CXX_PRAGMA_DIAGNOSTICS], |
17 |
[ |
18 |
|
19 |
AC_MSG_CHECKING(for compiler's pragma diagnostics) |
20 |
|
21 |
AC_LANG_PUSH([C++]) |
22 |
|
23 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
24 |
|
25 |
#include <stdlib.h> |
26 |
|
27 |
int foo(int a, int b) { |
28 |
int i = |
29 |
_Pragma("GCC diagnostic push") |
30 |
_Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") |
31 |
(a + b) |
32 |
_Pragma("GCC diagnostic pop") |
33 |
; |
34 |
return i; |
35 |
} |
36 |
|
37 |
]])],[ |
38 |
AC_MSG_RESULT(yes) |
39 |
have_embedded_pragma_diag=1 |
40 |
], [ |
41 |
AC_MSG_RESULT(no) |
42 |
have_embedded_pragma_diag=0 |
43 |
]) |
44 |
AC_DEFINE_UNQUOTED(HAVE_CXX_EMBEDDED_PRAGMA_DIAGNOSTICS,$have_embedded_pragma_diag,[Define to 1 if your compiler supports embedded pragma diagnostics.]) |
45 |
|
46 |
AC_LANG_POP([C++]) |
47 |
]) |