[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_CHECK_FUNC is not compatible with gcc -Werror

From: Eric Blake
Subject: Re: AC_CHECK_FUNC is not compatible with gcc -Werror
Date: Thu, 21 Jan 2010 18:35:44 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090812 Thunderbird/ Mnenhy/

According to Dmitry V. Levin on 1/21/2010 4:40 PM:
> Hi,
> There is no news that AC_CHECK_FUNC fails to find built-in functions when
> either AC_LANG_WERROR is used or -Werror is included in CFLAGS:

Yes, this is a well-known and frequently reported issue, and our usual
response has been to tell people "don't do it if it hurts".

> For a long time I maintain a patch that remedies this problem.  While the
> patch is probably not quite suitable for inclusion as is, it is known to
> work.  I've updated it for the HEAD and decided to give it a chance to be
> discussed here.  I hope the idea behind this patch could be used for a
> more acceptable fix.

Indeed - proposing patches is always a better approach than complaining.
No promises on when I can give this a deep-down review, but at least
you've got the ball rolling.

> +[#ifndef __GNUC__
> +choke me
> +#else
> +#undef $1
> +/* Declare this function with same prototype as __builtin_$1.
> +  This removes warning about conflicting type with builtin */
> +__typeof__(__builtin_$1) $1;
> +
> +__typeof__(__builtin_$1) *f = $1;
> +#endif
> +], [return f != $1;])])

Since we are really only caring about silencing gcc -Werror, I see no
reason to force a compilation for non-gcc compilers.  But the idea of
exploiting __GNUC__ and known gcc extensions, to avoid conflicts with
__builtin_* functions, does seem appealing, especially since we now have
the machinery to do it only once in a function rather than bloating every
use of AC_CHECK_FUNC throughout the configure file.

>                 [AS_VAR_SET([$[]3], [yes])],
> -               [AS_VAR_SET([$[]3], [no])])])
> +                               [AS_VAR_SET([$[]3], [yes])],
> +                               [AS_VAR_SET([$[]3], [no])])])])

It would be even slicker to do this without having to recompile (that is,
rewrite AC_LANG_FUNC_LINK_TRY to use the new logic, rather than making

Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]