qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
To: "Daniel P. Berrangé " <berrange@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>
Cc: "Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
	qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	qemu-arm@nongnu.org
Subject: Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card
Date: Fri, 10 Nov 2023 13:28:14 +0200	[thread overview]
Message-ID: <3wo3c.z2jjrdl2xn4i@linaro.org> (raw)
In-Reply-To: <ZU4SmH8LMGVJmGZp@redhat.com>

On Fri, 10 Nov 2023 13:23, "Daniel P. Berrangé" <berrange@redhat.com> wrote:
>On Fri, Nov 10, 2023 at 11:18:39AM +0000, Peter Maydell wrote:
>> On Fri, 10 Nov 2023 at 11:02, Manos Pitsidianakis
>> <manos.pitsidianakis@linaro.org> wrote:
>> >
>> > On Fri, 10 Nov 2023 12:21, Peter Maydell <peter.maydell@linaro.org> wrote:
>> > >This kind of thing is why Coverity's unused-result warning has a
>> > >lot of false positives. We shouldn't introduce extra code like
>> > >this to work around the fact that the tooling doesn't understand
>> > >our error-handling convention (i.e. error_fatal, and the way
>> > >that some functions report errors both via the return value and
>> > >also via the Error** argument).
>> >
>> > I respect that :). But I personally believe that clinging to C's
>> > inadequacies, instead of preventing bugs statically just because it adds
>> > some lines of code, is misguided. Proper code should strive to make bugs
>> > impossible in the first place.
>> 
>> I generally agree. The problem here really is that we've ended
>> up with this odd API convention that reports errors in two
>> ways. In an ideal world we'd tidy up our APIs to report errors
>> exactly in one way (presumably via the Error).
>
>The compelling thing about our slightly odd &error_fatal/error_abort
>approach is that we can directly get stack traces showing exactly
>where the error happened.
>
>If we just propagate the error up the stack to finally exit/abort,
>the origin context is essentially lost, and when it does abort, we
>don't get a snapshot of all threads at the time the error hit, as
>we've moved on in time.

FYI: It is possible to get a stack trace using gnu libunwind which is 
portable, dependency-free and runs on many targets: 
https://github.com/libunwind/libunwind#libunwind

Or llvm's libunwind which is also of great quality: 
https://bcain-llvm.readthedocs.io/projects/libunwind/en/latest/

They are also compatible with co-routines and JIT code (At least, the 
GNU one is, not sure about llvm).


  reply	other threads:[~2023-11-10 11:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10  9:16 [PATCH 0/2] Add QEMU_WARN_UNUSED_RESULT function attribute Manos Pitsidianakis
2023-11-10  9:16 ` [PATCH 1/2] Add QEMU_WARN_UNUSED_RESULT attribute Manos Pitsidianakis
2023-11-10  9:24   ` Daniel P. Berrangé
2023-11-10 11:15   ` Philippe Mathieu-Daudé
2023-11-10  9:16 ` [PATCH 2/2] Add warn_unused_result attr to AUD_register_card Manos Pitsidianakis
2023-11-10 10:21   ` Peter Maydell
2023-11-10 10:44     ` Manos Pitsidianakis
2023-11-10 11:18       ` Peter Maydell
2023-11-10 11:23         ` Daniel P. Berrangé
2023-11-10 11:28           ` Manos Pitsidianakis [this message]
2023-11-10 11:20       ` Daniel P. Berrangé
2023-11-10 11:25         ` Manos Pitsidianakis
2023-11-10 11:35         ` BALATON Zoltan
2023-11-10 11:43           ` Daniel P. Berrangé
2023-11-10 13:04         ` Philippe Mathieu-Daudé

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=3wo3c.z2jjrdl2xn4i@linaro.org \
    --to=manos.pitsidianakis@linaro.org \
    --cc=berrange@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.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).