Commit a6d45f9f authored by Per Cederqvist's avatar Per Cederqvist

(CMOD_C_ATTRIBUTE_UNUSED): Improve the test, by checking that

	__attribute__((unused)) is accepted in a function declaration.
	The ecc compiler on Linux/ia64 seems to accept it and give a
	warning when used on a local variable, but chokes on it when
	used in a function declaration.
parent 79e98375
dnl $Id: acinclude.m4,v 1.7 2002/08/17 17:24:20 ceder Exp $
dnl $Id: acinclude.m4,v 1.8 2002/10/02 07:23:06 ceder Exp $
dnl Copyright (C) 1994-1995, 1998-1999, 2001-2002 Lysator Academic Computer Association.
dnl
dnl This file is part of the LysKOM server.
......@@ -47,7 +47,8 @@ dnl
AC_DEFUN(CMOD_C_ATTRIBUTE_UNUSED,
[AC_MSG_CHECKING([whether $CC understands __attribute__((unused))])
AC_CACHE_VAL([cmod_cv_c_attribute_unused_understood],
AC_TRY_COMPILE(,[int i __attribute__((unused));],
AC_TRY_COMPILE([int foo(int *i __attribute__((unused))) { *i = 4711; }],
[int i __attribute__((unused));],
[cmod_cv_c_attribute_unused_understood=yes],
[cmod_cv_c_attribute_unused_understood=no]))
AC_MSG_RESULT($cmod_cv_c_attribute_unused_understood)
......
......@@ -40,10 +40,12 @@ dnl
AC_DEFUN(CMOD_C_ATTRIBUTE_UNUSED,
[AC_MSG_CHECKING([whether $CC understands __attribute__((unused))])
AC_CACHE_VAL([cmod_cv_c_attribute_unused_understood],
AC_TRY_COMPILE(,[int i __attribute__((unused));],
AC_TRY_COMPILE([int foo(int *i __attribute__((unused))) { *i = 4711; }],
[int i __attribute__((unused));],
[cmod_cv_c_attribute_unused_understood=yes],
[cmod_cv_c_attribute_unused_understood=no]))
AC_MSG_RESULT($cmod_cv_c_attribute_unused_understood)
[if test $cmod_cv_c_attribute_unused_understood = yes ; then]
AC_DEFINE(HAVE_ATTRIBUTE_UNUSED)
AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], 1,
[Define if your compiler supports __attribute__ ((unused)).])
[fi]])dnl
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment