Linux-6.9: file_lock mbrs moved to file_lock_core
[openafs.git] / src / cf / c-pragma.m4
1 dnl
2 dnl Test for _Pragma and how we need to use it
3 dnl
4 AC_DEFUN([OPENAFS_C_PRAGMA_TAUTOLOGICAL_POINTER_COMPARE],[
5 AC_MSG_CHECKING(for _Pragma recognition of -Wtautological-pointer-compare)
6 AC_CACHE_VAL(ac_cv__Pragma_tautological_pointer_compare, [
7 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8 _Pragma("clang diagnostic error \"-Wunknown-pragmas\"")
9 _Pragma("clang diagnostic ignored \"-Wtautological-pointer-compare\"")
10
11 void func(void)
12 {
13         return;
14 }
15 ]])],
16 [ac_cv__Pragma_tautological_pointer_compare=yes],
17 [ac_cv__Pragma_tautological_pointer_compare=no])])
18 AC_MSG_RESULT($ac_cv__Pragma_tautological_pointer_compare)
19 ])
20
21 AC_DEFUN([_OPENAFS_C_PRAGMA], [
22 AC_MSG_CHECKING(for _Pragma)
23 AC_CACHE_VAL(ac_cv__Pragma, [
24 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
25 _Pragma("")
26
27 void func(void)
28 {
29         return;
30 }
31 ]])],
32 [ac_cv__Pragma=yes],
33 [ac_cv__Pragma=no])])
34 AC_MSG_RESULT($ac_cv__Pragma)])
35
36 AC_DEFUN([OPENAFS_C_PRAGMA], [
37 _OPENAFS_C_PRAGMA
38 if test "$ac_cv__Pragma" = "yes"; then
39   AC_DEFINE(HAVE__PRAGMA, 1, [define if your compiler has _Pragma])
40   OPENAFS_C_PRAGMA_TAUTOLOGICAL_POINTER_COMPARE
41   if test "$ac_cv__Pragma_tautological_pointer_compare" = "yes"; then
42     AC_DEFINE(HAVE__PRAGMA_TAUTOLOGICAL_POINTER_COMPARE, 1,
43       [define if your compiler has _Pragma and recognizes -Wtautological-pointer-compare])
44   fi
45 fi
46 ])