[Top][All Lists]

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

Regression in ffs() detection on mingw

From: Daniel P . Berrangé
Subject: Regression in ffs() detection on mingw
Date: Mon, 16 Jul 2018 14:11:26 +0100
User-agent: Mutt/1.10.0 (2018-05-17)

Libvirt just updated to gnulib 5b78831df03b49408676227604cf16f90dee07ac,
from our previous snapshot d6397dde2e127e246e3eeb5254a21f42cac783c8.

Since doing that we see failure to build on mingw32/64 platforms due
to missing ffs() function

  util/virrandom.c: In function 'virRandomInt':
  util/virrandom.c:102:30: error: implicit declaration of function 'ffs' 
         return virRandomBits(ffs(max) - 1);
  cc1: all warnings being treated as errors

Reverting the following commit fixes the problem

  commit 2afc250c6fae929b95e8b8915b17379cd9f2e450
  Author: Bruno Haible <address@hidden>
  Date:   Sun May 13 16:13:27 2018 +0200

    ffs: Fix compilation error on Android.
    * m4/ffs.m4 (gl_FUNC_FFS): Use AC_LINK_IFELSE instead of AC_CHECK_FUNC.

Prior to this commit, config.log would show the following:

  configure:9801: checking for ffs
  configure:9801: i686-w64-mingw32-gcc -o conftest.exe  -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4   conftest.c  >&5
  conftest.c:91:6: warning: conflicting types for built-in function 'ffs' 
   char ffs ();
  /tmp/ccJxoiLq.o: In function `main':
  /home/berrange/src/virt/libvirt/conftest.c:102: undefined reference to `ffs'

Interestingly, it is failing to detect ffs() because it appears to be a
built-in. I thought it was not supposed to exist at all on mingw ?

After that gnulib change was applied for android, it now reports a warning
about implicit decl, but still succeeds, presumably because its a built-in.

  configure:25225: checking for ffs
  configure:25244: i686-w64-mingw32-gcc -o conftest.exe  -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4   conftest.c  >&5
  conftest.c: In function 'main':
  conftest.c:199:8: warning: implicit declaration of function 'ffs' 
   return ffs(x);
  configure:25244: $? = 0
  configure:25253: result: yes

Unfortunately, we are still missing the decl in the strings.h header file
provided by gnulib. Here is the generated header:

    /* Find the index of the least-significant set bit.  */
  #if 1
  # if !1
  _GL_FUNCDECL_SYS (ffs, int, (int i));
  # endif
  _GL_CXXALIAS_SYS (ffs, int, (int i));
  #elif defined GNULIB_POSIXCHECK
  # undef ffs
  _GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
  # endif

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

reply via email to

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