On 08/23/2010 11:02 AM, Yavor Doganov wrote:
I was wondering if it is possible (and whether it is a good idea in general) autoconf to print warnings for extra macro arguments instead of silently ignoring them.
I have to wonder if there are cases where rejecting extra arguments might not be advisable, because it hampers future extensions that assign meaning to those extra arguments while still being backwards compatible with earlier versions. That is, if 2.67 supports macro ABC(arg), then in 2.68 we add support for ABC(arg1, arg2), there is the question of whether the person calling ABC(arg1, arg2) will get sane semantics even if they use 2.67, by silently ignoring arg2.
On the other hand, any good extension is one where leaving the argument blank achieves the same behavior as the old version. And since the older version knows that it doesn't handle extra arguments, checking for a maximum $# (or, perhaps more robustly, checking that any arguments after a maximum $# are blank) may be feasible. But it would take a lot of work to add that to all the existing autoconf macros.
AC_CHECK_ALIGNOF(pthread_mutex_t,,[AC_INCLUDES_DEFAULT #include<pthread.h>]) The generated configure script fails on OpenBSD and Woe32, because <pthread.h> is not #include'd in the test program. It took me some time to spot where the problem is :-)
At any rate, this is an interesting feature request. Maybe the thing to do now is add mention of it in TODO, if we don't come up with a patch right away?
-- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org