[PATCH 2/3] Improve configure tests for ffsl

Garrett Cooper yanegomi at gmail.com
Sun Dec 2 17:57:28 PST 2012


In particular:
- ffsl always returns int, not long, on FreeBSD, Linux, and OSX.
- Mute compiler warnings about rv being unused (and the potential for
   compilers optimizing out the call completely) by dumping the value
   with printf(3).

Signed-off-by: Garrett Cooper <yanegomi at gmail.com>
---
  configure.ac | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1c52439..77a5110 100644
--- a/configure.ac
+++ b/configure.ac
@@ -906,7 +906,7 @@ AC_CACHE_CHECK([STATIC_PAGE_SHIFT],
  #include <stdio.h>
  ]],
  [[
-    long result;
+    int result;
      FILE *f;

  #ifdef _WIN32
@@ -925,7 +925,7 @@ AC_CACHE_CHECK([STATIC_PAGE_SHIFT],
      if (f == NULL) {
  	return 1;
      }
-    fprintf(f, "%u\n", result);
+    fprintf(f, "%d\n", result);
      fclose(f);

      return 0;
@@ -1070,11 +1070,13 @@ dnl Check for ffsl(3), and fail if not found.  This function exists on all
  dnl platforms that jemalloc currently has a chance of functioning on without
  dnl modification.
  JE_COMPILABLE([a program using ffsl], [
+#include <stdio.h>
  #include <strings.h>
  #include <string.h>
  ], [
  	{
  		int rv = ffsl(0x08);
+		printf("%d\n", rv);
  	}
  ], [je_cv_function_ffsl])
  if test "x${je_cv_function_ffsl}" != "xyes" ; then
-- 
1.8.0



More information about the jemalloc-discuss mailing list