Skip to content
Snippets Groups Projects
Commit f6870aa7 authored by Oliver Sander's avatar Oliver Sander
Browse files

Introduce DUNE_UNUSED as a portable wrapper to __attribute__((unused))

This works pretty much the same way as DUNE_DEPRECATED (without message).

Thanks to Elias Pipping for implementing this.


[[Imported from SVN: r6556]]
parent ba7292eb
Branches
Tags
No related merge requests found
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_COMMON_UNUSED_HH
#define DUNE_COMMON_UNUSED_HH
#ifndef HAS_ATTRIBUTE_UNUSED
#define DUNE_UNUSED
#else
#define DUNE_UNUSED __attribute__((unused))
#endif
#endif
......@@ -34,6 +34,7 @@ ALLM4S = \
dune_mpi.m4 \
dune_streams.m4 \
dune_tr1_headers.m4 \
dune_unused.m4 \
fortran_overwrite.m4 \
gmp.m4 \
hdf5.m4 \
......
......@@ -25,6 +25,7 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
AC_REQUIRE([MAKE_SHARED])
AC_REQUIRE([DUNE_LINKCXX])
AC_REQUIRE([DUNE_CHECKDEPRECATED])
AC_REQUIRE([DUNE_CHECKUNUSED])
AC_REQUIRE([DUNE_SET_MINIMAL_DEBUG_LEVEL])
AC_REQUIRE([DUNE_PATH_XDR])
AC_REQUIRE([DUNE_MPI])
......
# Check if __attribute__((unused)) is supported
AC_DEFUN([DUNE_CHECKUNUSED],[
AC_CACHE_CHECK([for __attribute__((unused))], dune_cv_attribute_unused, [
AC_LANG_PUSH([C++])
AC_TRY_COMPILE([#define UNUSED __attribute__((unused))],
[void f(int a UNUSED, int UNUSED)
{
int b UNUSED;
}],
[],
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))?])],)
AH_BOTTOM([#include <dune/common/unused.hh>])
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment