From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>,
Michal Privoznik <mprivozn@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] meson: Avoid implicit declaration of functions
Date: Mon, 29 May 2023 13:04:51 +0200 [thread overview]
Message-ID: <ca82a193-1be7-9b81-8e65-1de65efb842f@redhat.com> (raw)
In-Reply-To: <CAFEAcA_e9JmNacpFyG+SZareve2HJx+dFQwLbjyhmr6brm=9QQ@mail.gmail.com>
On 5/29/23 12:24, Peter Maydell wrote:
> 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...
It seems to be a lint:
* QA Notice: Found the following implicit function declarations in configure logs:
* /var/tmp/portage/app-emulation/qemu-7.2.0-r3/work/qemu-7.2.0/tools-build/meson-logs/meson-log.txt:562 - malloc_trim
* /var/tmp/portage/app-emulation/qemu-7.2.0-r3/work/qemu-7.2.0/tools-build/meson-logs/meson-log.txt:591 - statx
* /var/tmp/portage/app-emulation/qemu-7.2.0-r3/work/qemu-7.2.0/tools-build/meson-logs/meson-log.txt:627 - statx
* /var/tmp/portage/app-emulation/qemu-7.2.0-r3/work/qemu-7.2.0/softmmu-build/meson-logs/meson-log.txt:718 - malloc_trim
* /var/tmp/portage/app-emulation/qemu-7.2.0-r3/work/qemu-7.2.0/softmmu-build/meson-logs/meson-log.txt:747 - statx
* /var/tmp/portage/app-emulation/qemu-7.2.0-r3/work/qemu-7.2.0/softmmu-build/meson-logs/meson-log.txt:783 - statx
* Check that no features were accidentally disabled.
* See https://wiki.gentoo.org/wiki/Modern_C_porting.
So, not an actual bug but more of a favor that we can do to the distros.
>> + cc.has_function('malloc_trim', prefix: '#include <malloc.h>') and \
>> cc.links('''#include <malloc.h>
>> int main(void) { malloc_trim(0); return 0; }''')
>
> This seems super clunky -- surely this isn't the way Meson
> intends people to write tests ?
For this one can remove the cc.links test altogether, so this part of the
patch is okay.
The statx is less clear.
>
> +statx_test = statx_prefix + '''
> int main(void) {
> struct statx statxbuf;
> statx(0, "", 0, STATX_BASIC_STATS, &statxbuf);
> return 0;
> }'''
>
> -has_statx = cc.links(statx_test)
> +has_statx = cc.has_function('statx', prefix: statx_prefix) and \
> + cc.links(statx_test)
Here we could replace cc.links with a cc.has_header_symbol('sys/stat.h',
'STATX_BASIC_STATS'), and likewise for has_statx_mnt_id below.
If it was just has_statx I would rather leave things as is. However,
given that there is has_statx_mnt_id too, I'd apply a v2 that removes
usage of cc.links for these three tests.
Paolo
next prev parent reply other threads:[~2023-05-29 11:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-29 7:56 [PATCH] meson: Avoid implicit declaration of functions Michal Privoznik
2023-05-29 10:24 ` Peter Maydell
2023-05-29 11:04 ` Paolo Bonzini [this message]
2023-05-29 11:13 ` Michael Tokarev
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=ca82a193-1be7-9b81-8e65-1de65efb842f@redhat.com \
--to=pbonzini@redhat.com \
--cc=mprivozn@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).