[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 21/26] configure, meson: move more compiler checks to Meson
From: |
Peter Maydell |
Subject: |
Re: [PULL 21/26] configure, meson: move more compiler checks to Meson |
Date: |
Mon, 15 Nov 2021 16:36:46 +0000 |
On Thu, 14 Oct 2021 at 17:49, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Message-Id: <20211007130829.632254-15-pbonzini@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> configure | 91 ------------------------------------------------
> meson.build | 44 +++++++++++++++++++++++
> util/meson.build | 4 ++-
> 3 files changed, 47 insertions(+), 92 deletions(-)
> diff --git a/meson.build b/meson.build
> index 6bf43e6d30..6b7487b725 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1550,6 +1550,8 @@ 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>
Hi -- I've just noticed that this change breaks compilation for me,
because this test incorrectly fails to set CONFIG_IOVEC on a system
where the header defines 'struct iovec'. This seems to be because
"struct iovec" isn't a valid thing to test with has_header_symbol,
because it provokes a compiler error from clang.
The meson-log.txt shows:
Running compile:
Working directory:
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/meson-private/tmpfspzse_8
Command line: clang-7 -m64 -mcx16
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/meson-private/tmpfspzse_8/testfile.c
-o /mnt/nvme
disk/linaro/qemu-from-laptop/qemu/build/arm-clang/meson-private/tmpfspzse_8/output.obj
-c -fsanitize=undefined -fno-sanitize=shift-base -Werror
-D_FILE_OFFSET_BITS=64 -O0 -Werror=implicit-function-declaration
-Werror=unknown-warning-option -Werror=unused-command-line-argument
-Werror=i
gnored-optimization-argument -std=gnu11
Code:
#include <sys/uio.h>
int main(void) {
/* If it's not defined as a macro, try to use as a symbol */
#ifndef struct iovec
struct iovec;
#endif
return 0;
}
Compiler stdout:
Compiler stderr:
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/meson-private/tmpfspzse_8/testfile.c:5:28:
error: extra tokens at end of #ifndef di
rective [-Werror,-Wextra-tokens]
#ifndef struct iovec
^
//
1 error generated.
...skipping...
#ifndef struct iovec
struct iovec;
#endif
return 0;
}
Compiler stdout:
Compiler stderr:
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/meson-private/tmpfspzse_8/testfile.c:5:28:
error: extra tokens at end of #ifndef r]
#ifndef struct iovec
^
//
1 error generated.
Header <sys/uio.h> has symbol "struct iovec" : NO
For comparison, with a gcc build the test works because gcc
happens to merely warn rather than fail for the syntax issue:
Running compile:
Working directory:
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/x86/meson-private/tmpidzebj6t
Command line: ccache gcc -m64 -mcx16
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/x86/meson-private/tmpidzebj6t/testfile.c
-o /mnt/nvmedis
k/linaro/qemu-from-laptop/qemu/build/x86/meson-private/tmpidzebj6t/output.obj
-c -D_FILE_OFFSET_BITS=64 -O0 -std=gnu11
Code:
#include <sys/uio.h>
int main(void) {
/* If it's not defined as a macro, try to use as a symbol */
int main(void) { return 0; }
Compiler stdout:
Compiler stderr:
...skipping...
#ifndef struct iovec
struct iovec;
#endif
return 0;
}
Compiler stdout:
Compiler stderr:
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/x86/meson-private/tmpidzebj6t/testfile.c:
In function 'main':
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/x86/meson-private/tmpidzebj6t/testfile.c:5:28:
warning: extra tokens at end of #ifndef direcve
5 | #ifndef struct iovec
| ^~~~~
Header <sys/uio.h> has symbol "struct iovec" : YES
-- PMM
- Re: [PULL 21/26] configure, meson: move more compiler checks to Meson,
Peter Maydell <=