autoconf-patches
[Top][All Lists]
Advanced

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

Re: Bug#557632: broken test for mmap


From: Ralf Wildenhues
Subject: Re: Bug#557632: broken test for mmap
Date: Tue, 24 Nov 2009 11:37:39 +0100
User-agent: Mutt/1.5.20 (2009-08-09)

tags upstream patch
thanks

Hello Michal,

thanks for the bug report.  Adding autoconf-patches.

* Michal Čihař wrote on Mon, Nov 23, 2009 at 01:27:43PM CET:
> the mmap test currently present in autoconf fails to compile:
> 
> conftest.cpp:154: warning: deprecated conversion from string constant to
> 'char*'
> conftest.cpp:157: error: invalid conversion from 'void*' to 'char*'
> 
> what leads to not detecting mmap on Debian and because of this some
> packages fail to build (I did hit this on sdcv).

Proposed patch.  Fixes the test with CC=g++.  OK to apply and add Michal
to THANKS?

Cheers,
Ralf

    Fix AC_FUNC_MMAP regression with C++ compiler in 2.65.
    
    * lib/autoconf/functions.m4 (AC_FUNC_MMAP): Use const char*
    for the constant string.  Cast void* to char* for assignment.
    * NEWS, THANKS: Update.
    Report by Michal Čihař.

diff --git a/NEWS b/NEWS
index b72eb17..32fa957 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,10 @@
 GNU Autoconf NEWS - User visible changes.
 
+* Major changes in Autoconf 2.65a (????-??-??) [experimental]
+  Released by ???? ????
+
+** AC_FUNC_MMAP works in C++ mode again.  Regression introduced in 2.64.
+
 * Major changes in Autoconf 2.65 (2009-11-21) [stable]
   Released by Eric Blake, based on git versions 2.64.*.
 
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 6b6e7fc..14a8cb9 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -1258,6 +1258,7 @@ int
 main ()
 {
   char *data, *data2, *data3;
+  const char *cdata2;
   int i, pagesize;
   int fd, fd2;
 
@@ -1282,10 +1283,10 @@ main ()
   fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
   if (fd2 < 0)
     return 4;
-  data2 = "";
-  if (write (fd2, data2, 1) != 1)
+  cdata2 = "";
+  if (write (fd2, cdata2, 1) != 1)
     return 5;
-  data2 = mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);
+  data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 
0L);
   if (data2 == MAP_FAILED)
     return 6;
   for (i = 0; i < pagesize; ++i)




reply via email to

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