configure: make sure we flag invalid attributes

Use -Werror=attributes so we can actually test for non-supported
attributes without spewing warnings.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2017-02-23 19:22:27 -08:00
parent 3fa2558a69
commit bc18af18f0
2 changed files with 3 additions and 0 deletions

2
aclocal.m4 vendored
View File

@ -63,6 +63,7 @@ AC_DEFUN(PA_FUNC_ATTRIBUTE,
#include <stdarg.h>
extern ifelse([$3],[],[void *],[$3]) __attribute__(($1$2))
bar(ifelse([$4],[],[int],[$4]));
void *foo(void);
void *foo(void)
{
return bar(ifelse([$5],[],[1],[$5]));
@ -86,6 +87,7 @@ AC_DEFUN(PA_FUNC_ATTRIBUTE_ERROR,
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <stdarg.h>
extern void __attribute__((error("message"))) barf(void);
void foo(void);
void foo(void)
{
if (0)

View File

@ -137,6 +137,7 @@ dnl Check for supported gcc attributes; some compilers (e.g. Sun CC)
dnl support these, but don't define __GNUC__ as they don't support
dnl some other features of gcc.
dnl
PA_ADD_CFLAGS([-Werror=attributes])
PA_FUNC_ATTRIBUTE(noreturn)
PA_FUNC_ATTRIBUTE(returns_nonnull)
PA_FUNC_ATTRIBUTE(malloc)