From a1f81535cfd977ff5701b40b41ba7792f0bb7852 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@dune-project.org>
Date: Wed, 6 Feb 2013 21:46:30 +0000
Subject: [PATCH] Fix buggy use of AC_TRY_COMPILE

Thanks to Andreas Lauser for this patch.

Here is his own commit message:

From: Andreas Lauser <and@poware.org>
Date: Mon, 4 Feb 2013 15:34:22 +0100
Subject: [PATCH] fix the test for __attribute__((unused))

it contained two errors which "anihilated" themselfs: the first was a
syntax error in the test itself (the UNUSED macro must be placed
before the identifier of the variable), which caused the compiler to
always return an error. this was compensated by an incorrect
invocation of the AC_TRY_COMPILE macro which featured an empty
argument as third argument instead of the action to be executed if the
test succeeded. this in turn always lead the forth argument (which was
intended by the test to be executed if the test succeeds but was
actually executed if it failed) to be always triggered. In turn this
leads me to the conclusion that DUNE was never compiled using a
compiler which does not support __attribute__((unused)) since this
macro was introduced...


[[Imported from SVN: r7105]]
---
 m4/dune_unused.m4 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/m4/dune_unused.m4 b/m4/dune_unused.m4
index 2fe13bbd8..db72bf260 100644
--- a/m4/dune_unused.m4
+++ b/m4/dune_unused.m4
@@ -6,9 +6,8 @@ AC_DEFUN([DUNE_CHECKUNUSED],[
         AC_TRY_COMPILE([#define UNUSED __attribute__((unused))],
                        [void f(int a UNUSED, int UNUSED)
                         {
-                          int b UNUSED;
+                          int UNUSED b;
                         }],
-                        [],
                         dune_cv_attribute_unused="yes",
                         dune_cv_attribute_unused="no")
         AC_LANG_POP([C++])
-- 
GitLab