[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] meson: Avoid implicit declaration of functions
|
From: |
Peter Maydell |
|
Subject: |
Re: [PATCH] meson: Avoid implicit declaration of functions |
|
Date: |
Mon, 29 May 2023 11:24:14 +0100 |
On Mon, 29 May 2023 at 08:58, Michal Privoznik <mprivozn@redhat.com> wrote:
>
> While detecting a presence of a function via 'cc.links()'
> gives desired result (i.e. detects whether function is present),
> it also produces a warning on systems where the function is not
> present, e.g.:
>
> qemu.git/build/meson-private/tmph74x3p38/testfile.c:2:34: \
> warning: implicit declaration of function 'malloc_trim'
> [-Wimplicit-function-declaration]
Produces a warning where ? On stdout/stderr ?
The linked bug report says "in the configure logs"
which is kinda vague. Warnings in the logfiles are
not a problem; warnings in the terminal output are...
> diff --git a/meson.build b/meson.build
> index 2d48aa1e2e..5da4dbac24 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1797,6 +1797,7 @@ malloc = []
> if get_option('malloc') == 'system'
> has_malloc_trim = \
> get_option('malloc_trim').allowed() and \
> + cc.has_function('malloc_trim', prefix: '#include <malloc.h>') and \
> cc.links('''#include <malloc.h>
> int main(void) { malloc_trim(0); return 0; }''')
> else
This seems super clunky -- surely this isn't the way Meson
intends people to write tests ?
thanks
-- PMM