[Pkg-samba-maint] Bug#749981: configure test HAVE_VISIBILITY_ATTR unnecessarily introduces nested functions

Michael Tautschnig mt at debian.org
Sat May 31 12:01:08 UTC 2014


Package: ntdb
Version: 1.0-4
Severity: wishlist
Usertags: goto-cc

While building the package I noticed an unexpected

[...]
Checking compiler accepts -fvisibility=hidden                                     : yes
Checking for HAVE_VISIBILITY_ATTR                                                 : not found

when using a compiler that does not have support for nested functions. Yet it
seems that these aspects should not interact, but the configure check in
lib/replace/wscript uses the following:

    if conf.CHECK_CFLAGS('-fvisibility=hidden'):
        conf.env.VISIBILITY_CFLAGS = '-fvisibility=hidden'
        conf.CHECK_CODE('''void vis_foo1(void) {}
                           __attribute__((visibility("default"))) void vis_foo2(void) {}''',
                        cflags=conf.env.VISIBILITY_CFLAGS,
                        define='HAVE_VISIBILITY_ATTR')

with buildtools/wafsamba/samba_autoconf.py doing the following:

    if addmain:
        fragment='%s\n%s\n int main(void) { %s; return 0; }\n' % (defs, hdrs, code)
    else:
        fragment='%s\n%s\n%s\n' % (defs, hdrs, code)

Hence the function vis_foo1 and vis_foo2 will end up being defined within main,
resulting in nested functions. This unnecessarily breaks the build using
compilers such as Clang.

To fix the problem, conf.CHECK_CODE should be called with link=False,
addmain=False.

Best,
Michael

PS.: This configuration bit appears to exist as literal copy in several
packages, the bug report will be cloned accordingly.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 859 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-samba-maint/attachments/20140531/774ec662/attachment.sig>


More information about the Pkg-samba-maint mailing list