summaryrefslogtreecommitdiff
path: root/lib/make/aclocal.m4
diff options
context:
space:
mode:
authorschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2005-09-26 00:21:00 +0000
committerschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2005-09-26 00:21:00 +0000
commita1492b067055e73d5b61dfe45c3cd4200bee64a2 (patch)
treef0677049f29bd0d18f50337523989fc8a1c563ac /lib/make/aclocal.m4
parent06d94fb1dae1bedc506b432ccb1157d6aaa874d8 (diff)
Introduce macros CCTK_DECLARE and CCTK_DECLARE_INIT which declare or
declare and initialise local variables. They also add the necessary magic to prevent compiler warnings about unused variables. If the compiler supports __attribute__((unused)), then use this. Otherwise, use the existing fallback of taking the variable's address. In Fortran, use the variable's kind as fallback. Use these macros in autogenerated code and in "cctk.h". git-svn-id: http://svn.cactuscode.org/flesh/trunk@4146 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/make/aclocal.m4')
-rw-r--r--lib/make/aclocal.m425
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/make/aclocal.m4 b/lib/make/aclocal.m4
index a47da973..7d737582 100644
--- a/lib/make/aclocal.m4
+++ b/lib/make/aclocal.m4
@@ -330,3 +330,28 @@ if test "$cctk_cv_have_cxx_bool" = "yes" ; then
AC_DEFINE(HAVE_CCTK_CXX_BOOL)
fi
])
+
+
+
+AC_DEFUN(CCTK_C_ATTRIBUTE_UNUSED,
+[AC_CACHE_CHECK([for C __attribute__((unused))], cctk_cv_have_c_attribute_unused,
+[cctk_cv_have_c_attribute_unused=no
+AC_TRY_COMPILE(, double * foo __attribute__((unused));, cctk_cv_have_c_attribute_unused=yes, cctk_cv_have_c_attribute_unused=no)
+])
+if test "$cctk_cv_have_c_attribute_unused" = "yes" ; then
+ AC_DEFINE(HAVE_CCTK_C_ATTRIBUTE_UNUSED)
+fi
+])
+
+AC_DEFUN(CCTK_CXX_ATTRIBUTE_UNUSED,
+[AC_CACHE_CHECK([for CXX __attribute__((unused))], cctk_cv_have_cxx_attribute_unused,
+[cctk_cv_have_cxx_attribute_unused=no
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_TRY_COMPILE(, double * foo __attribute__((unused));, cctk_cv_have_cxx_attribute_unused=yes, cctk_cv_have_cxx_attribute_unused=no)
+AC_LANG_RESTORE
+])
+if test "$cctk_cv_have_cxx_attribute_unused" = "yes" ; then
+ AC_DEFINE(HAVE_CCTK_CXX_ATTRIBUTE_UNUSED)
+fi
+])