Re: AC_PROG_CC_C99

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

 



Noah Misch <noah@xxxxxxxxxxxxxx> writes:

> configure:18743: warning: overflow in implicit constant conversion

That one is easy to fix; I installed the patch enclosed below.

The other problems are harder.  Basically, the problem is that
Autoconf needs a way to tell whether a function exists, without
knowing what its type is.  There's no way to ask this question in
portable C.  The current code tries to do this by declaring the
function and seeing whether we can link to it.  Obviously this doesn't
work in general and you've found a place where it doesn't work.

One possible fix is to modify AC_CHECK_FUNC so that it includes all
the standard C99 headers that define functions, and tries to use
function without declaring it.  It could use this strategy if the
current strategy does not find the function.  That would catch all the
problems you found.  It probably wouldn't suffice in general but it
would work for this common case, so I suppose it'd be an improvement.

However, it would slow down "configure" when discovering that a
function does not exist, since it'd try to link twice.  This could be
worked around by trying to link to a common omnipresent function like
"strlen" and seeing whether the glitch exists there.  But now this is
turning into a 100- or 200-line patch and I don't have time to look
into it right now.

2004-12-02  Paul Eggert  <eggert@xxxxxxxxxxx>

	* lib/autoconf/functions.m4 (AC_FUNC_MEMCMP): Use
	"char c = '\200';" rather than "char c = 0x80;" as the
	latter doesn't conform to the strict C standard due to
	overflow on signed char hosts.

Index: functions.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/functions.m4,v
retrieving revision 1.84
retrieving revision 1.85
diff -p -u -r1.84 -r1.85
--- functions.m4	24 May 2004 23:18:06 -0000	1.84
+++ functions.m4	2 Dec 2004 21:50:46 -0000	1.85
@@ -910,7 +910,7 @@ AC_DEFUN([AC_FUNC_MEMCMP],
 [AC_CACHE_CHECK([for working memcmp], ac_cv_func_memcmp_working,
 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[
   /* Some versions of memcmp are not 8-bit clean.  */
-  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  char c0 = '\100', c1 = '\200', c2 = '\201';
   if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
     exit (1);
 


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux