All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH] meson: fix botched compile check conversions
Date: Tue, 16 Nov 2021 11:13:50 +0000	[thread overview]
Message-ID: <YZOSboL0YCFKYFh3@redhat.com> (raw)
In-Reply-To: <20211116093834.76615-1-pbonzini@redhat.com>

On Tue, Nov 16, 2021 at 10:38:34AM +0100, Paolo Bonzini wrote:
> Fix a bunch of incorrect conversions from configure to Meson, which result
> in different outcomes with --extra-cflags=-Werror.
> 
> pthread_setname_np needs "#define _GNU_SOURCE" on Linux (which I am using
> also for the non-Linux check, so that it correctly fails with an error
> about having too few parameters).
> 
> Fix struct checks to use has_type instead of has_symbol, and "#define
> _GNU_SOURCE" too in the case of struct mmsghdr.

Ok, so relies on fact that passing an incorrect number of arguments
is a fatal error, when function prototypes are available, even
without -Werror being set.

Side note, GCC looks to be trying to make explicit function prototypes
mandatory at last

  https://linuxplumbersconf.org/event/11/contributions/1014/

> Remove an apostrophe that ended up at the end of a #include line.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

And the setname_np stuff, I've tested on Fedora 34 and FreebSD 12.2

Tested-by: Daniel P. Berrangé <berrange@redhat.com>


> ---
>  meson.build | 24 +++++++++++++++---------
>  1 file changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 2ece4fe088..93a5e50a16 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1547,8 +1547,6 @@ config_host_data.set('CONFIG_INOTIFY',
>                       cc.has_header_symbol('sys/inotify.h', 'inotify_init'))
>  config_host_data.set('CONFIG_INOTIFY1',
>                       cc.has_header_symbol('sys/inotify.h', 'inotify_init1'))
> -config_host_data.set('CONFIG_IOVEC',
> -                     cc.has_header_symbol('sys/uio.h', 'struct iovec'))
>  config_host_data.set('CONFIG_MACHINE_BSWAP_H',
>                       cc.has_header_symbol('machine/bswap.h', 'bswap32',
>                                            prefix: '''#include <sys/endian.h>
> @@ -1561,8 +1559,6 @@ config_host_data.set('CONFIG_SYSMACROS',
>                       cc.has_header_symbol('sys/sysmacros.h', 'makedev'))
>  config_host_data.set('HAVE_OPTRESET',
>                       cc.has_header_symbol('getopt.h', 'optreset'))
> -config_host_data.set('HAVE_UTMPX',
> -                     cc.has_header_symbol('utmpx.h', 'struct utmpx'))
>  config_host_data.set('HAVE_IPPROTO_MPTCP',
>                       cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP'))
>  
> @@ -1574,6 +1570,14 @@ config_host_data.set('HAVE_STRUCT_STAT_ST_ATIM',
>                       cc.has_member('struct stat', 'st_atim',
>                                     prefix: '#include <sys/stat.h>'))
>  
> +# has_type
> +config_host_data.set('CONFIG_IOVEC',
> +                     cc.has_type('struct iovec',
> +                                 prefix: '#include <sys/uio.h>'))
> +config_host_data.set('HAVE_UTMPX',
> +                     cc.has_type('struct utmpx',
> +                                 prefix: '#include <utmpx.h>'))
> +
>  config_host_data.set('CONFIG_EVENTFD', cc.links('''
>    #include <sys/eventfd.h>
>    int main(void) { return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); }'''))
> @@ -1615,7 +1619,7 @@ config_host_data.set('CONFIG_POSIX_MADVISE', cc.links(gnu_source_prefix + '''
>    #include <stddef.h>
>    int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }'''))
>  
> -config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_W_TID', cc.links('''
> +config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_W_TID', cc.links(gnu_source_prefix + '''
>    #include <pthread.h>
>  
>    static void *f(void *p) { return NULL; }
> @@ -1626,7 +1630,7 @@ config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_W_TID', cc.links('''
>      pthread_setname_np(thread, "QEMU");
>      return 0;
>    }''', dependencies: threads))
> -config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_WO_TID', cc.links('''
> +config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_WO_TID', cc.links(gnu_source_prefix + '''
>    #include <pthread.h>
>  
>    static void *f(void *p) { pthread_setname_np("QEMU"); return NULL; }
> @@ -1662,8 +1666,10 @@ config_host_data.set('HAVE_MLOCKALL', cc.links(gnu_source_prefix + '''
>  
>  have_l2tpv3 = false
>  if not get_option('l2tpv3').disabled() and have_system
> -  have_l2tpv3 = (cc.has_header_symbol('sys/socket.h', 'struct mmsghdr')
> -                 and cc.has_header('linux/ip.h'))
> +  have_l2tpv3 = cc.has_type('struct mmsghdr',
> +    prefix: gnu_source_prefix + '''
> +      #include <sys/socket.h>
> +      #include <linux/ip.h>''')
>  endif
>  config_host_data.set('CONFIG_L2TPV3', have_l2tpv3)
>  
> @@ -1689,7 +1695,7 @@ config_host_data.set('CONFIG_NETMAP', have_netmap)
>  # xfs headers will not try to redefine structs from linux headers
>  # if this macro is set.
>  config_host_data.set('HAVE_FSXATTR', cc.links('''
> -  #include <linux/fs.h>'
> +  #include <linux/fs.h>
>    struct fsxattr foo;
>    int main(void) {
>      return 0;
> -- 
> 2.33.1
> 
> 

Regards,
Daniel
-- 
|: 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	other threads:[~2021-11-16 11:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16  9:38 [PATCH] meson: fix botched compile check conversions Paolo Bonzini
2021-11-16 11:13 ` Daniel P. Berrangé [this message]
2021-11-16 14:24   ` Paolo Bonzini
2021-11-16 11:51 ` Peter Maydell
2021-11-16 12:00   ` Daniel P. Berrangé
2021-11-16 13:10     ` Peter Maydell
2021-11-16 13:15       ` Daniel P. Berrangé
2021-11-16 14:31     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZOSboL0YCFKYFh3@redhat.com \
    --to=berrange@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.