a39154ecac
GCC warns when a function attribute has no effect. The autoconf check turns warnings about attributes into errors, therefore thinking that they did not work. The reason was that the test function returned void, which is not suitable for checking both __malloc__ and __warn_unused_result__.
25 lines
663 B
Text
25 lines
663 B
Text
dnl Check to find out whether function attributes are supported.
|
|
dnl If they are not, #define them to be nothing.
|
|
|
|
AC_DEFUN([tinc_ATTRIBUTE],
|
|
[
|
|
AC_CACHE_CHECK([for working $1 attribute], tinc_cv_attribute_$1,
|
|
[
|
|
tempcflags="$CFLAGS"
|
|
CFLAGS="$CFLAGS -Wall -Werror"
|
|
AC_COMPILE_IFELSE(
|
|
[AC_LANG_SOURCE(
|
|
[void *test(void) __attribute__ (($1));
|
|
void *test(void) { return (void *)0; }
|
|
],
|
|
)],
|
|
[tinc_cv_attribute_$1=yes],
|
|
[tinc_cv_attribute_$1=no]
|
|
)
|
|
CFLAGS="$tempcflags"
|
|
])
|
|
|
|
if test ${tinc_cv_attribute_$1} = no; then
|
|
AC_DEFINE([$1], [], [Defined if the $1 attribute is not supported.])
|
|
fi
|
|
])
|