From a79529ae748eaac4010c0f8d29f1bb424415b3bc Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine <Claus-Justus.Heine@IANS.Uni-Stuttgart.DE> Date: Fri, 2 Oct 2015 13:15:33 +0000 Subject: [PATCH] Check for unused attribute. --- m4/alberta-unused.m4 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 m4/alberta-unused.m4 diff --git a/m4/alberta-unused.m4 b/m4/alberta-unused.m4 new file mode 100644 index 0000000..ced6f17 --- /dev/null +++ b/m4/alberta-unused.m4 @@ -0,0 +1,24 @@ +# Check if __attribute__((unused)) is supported +# Stolen from dune-common (thanks) + +AC_DEFUN([ALBERTA_CHECK_UNUSED],[ + AC_CACHE_CHECK([for __attribute__((unused))], dune_cv_attribute_unused, [ + AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #define UNUSED __attribute__((unused)) + void f(int a UNUSED, int UNUSED) + { + int UNUSED b; + } + ]], + [])], + dune_cv_attribute_unused="yes", + dune_cv_attribute_unused="no") + AC_LANG_POP([C++]) + ]) + + AS_IF([test "x$dune_cv_attribute_unused" = "xyes"], + [AC_DEFINE_UNQUOTED(HAS_ATTRIBUTE_UNUSED, + 1, + [does the compiler support __attribute__((unused))?])],) +]) -- GitLab