From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-trivial@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] Drop QEMU_GNUC_PREREQ() checks for gcc older than 4.1
Date: Thu, 02 Feb 2017 11:17:22 +0100 [thread overview]
Message-ID: <87vass7v7x.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <6c841220-8219-69fc-413f-c6ad320fe2ed@redhat.com> (Paolo Bonzini's message of "Wed, 1 Feb 2017 17:09:00 -0800")
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 31/01/2017 22:49, Markus Armbruster wrote:
>> Paolo Bonzini <pbonzini@redhat.com> writes:
>>
>>> On 31/01/2017 12:40, Markus Armbruster wrote:
>>>>>
>>>>> #define QEMU_NORETURN __attribute__ ((__noreturn__))
>>>>>
>>>>> -#if QEMU_GNUC_PREREQ(3, 4)
>>>>> #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
>>>>> -#else
>>>>> -#define QEMU_WARN_UNUSED_RESULT
>>>>> -#endif
>>>> Should we inline this macro?
>>>>
>>>>>
>>>>> -#if QEMU_GNUC_PREREQ(4, 0)
>>>>> #define QEMU_SENTINEL __attribute__((sentinel))
>>>>> -#else
>>>>> -#define QEMU_SENTINEL
>>>>> -#endif
>>>> Likewise.
>>>
>>> Why, since we don't do that for QEMU_NORETURN, QEMU_PACKED, etc.?
>>
>> Because we do it for aligned, always_inline, constructor, format, mode,
>> noinline, and in places even noreturn and packed:
>>
>> $ git-grep __attribute__ | sed '/define/d;s/.*__attribute__ *((\([A-Za-z0-9_]*\).*/\1/' | sort -u
>>
>
> Uh oh. :) You have to remove uses in firmware and in imported code
> (which covers mode, format and noreturn), but there's certainly room for
> some BiteSizedTasks.
>
> For sure noinline should be wrapped by a macro so that you also include
> noclone (usually you want to thwart some compiler optimization so both
> are needed).
>
> That leaves aligned, always_inline and constructor. always_inline has
> three users, constructors has many, aligned has many and there's
> QEMU_ALIGNED too. The smallest work would be to convert these three to
> QEMU_* rather than convert QEMU_* to __attribute__.
I prefer "direct" expression to hiding behind macros, unless there's a
reason for macros. A common reason is portability. Occasionally
abstraction, say when the direct expression doesn't really convey what
you're trying to do, or it's is overly verbose.
Anyway, I'm not particular on how we use attributes. Since you seem to
have more specific ideas, could you file suitable BiteSizedTasks?
WARNING: multiple messages have this Message-ID (diff)
From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-trivial@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] Drop QEMU_GNUC_PREREQ() checks for gcc older than 4.1
Date: Thu, 02 Feb 2017 11:17:22 +0100 [thread overview]
Message-ID: <87vass7v7x.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <6c841220-8219-69fc-413f-c6ad320fe2ed@redhat.com> (Paolo Bonzini's message of "Wed, 1 Feb 2017 17:09:00 -0800")
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 31/01/2017 22:49, Markus Armbruster wrote:
>> Paolo Bonzini <pbonzini@redhat.com> writes:
>>
>>> On 31/01/2017 12:40, Markus Armbruster wrote:
>>>>>
>>>>> #define QEMU_NORETURN __attribute__ ((__noreturn__))
>>>>>
>>>>> -#if QEMU_GNUC_PREREQ(3, 4)
>>>>> #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
>>>>> -#else
>>>>> -#define QEMU_WARN_UNUSED_RESULT
>>>>> -#endif
>>>> Should we inline this macro?
>>>>
>>>>>
>>>>> -#if QEMU_GNUC_PREREQ(4, 0)
>>>>> #define QEMU_SENTINEL __attribute__((sentinel))
>>>>> -#else
>>>>> -#define QEMU_SENTINEL
>>>>> -#endif
>>>> Likewise.
>>>
>>> Why, since we don't do that for QEMU_NORETURN, QEMU_PACKED, etc.?
>>
>> Because we do it for aligned, always_inline, constructor, format, mode,
>> noinline, and in places even noreturn and packed:
>>
>> $ git-grep __attribute__ | sed '/define/d;s/.*__attribute__ *((\([A-Za-z0-9_]*\).*/\1/' | sort -u
>>
>
> Uh oh. :) You have to remove uses in firmware and in imported code
> (which covers mode, format and noreturn), but there's certainly room for
> some BiteSizedTasks.
>
> For sure noinline should be wrapped by a macro so that you also include
> noclone (usually you want to thwart some compiler optimization so both
> are needed).
>
> That leaves aligned, always_inline and constructor. always_inline has
> three users, constructors has many, aligned has many and there's
> QEMU_ALIGNED too. The smallest work would be to convert these three to
> QEMU_* rather than convert QEMU_* to __attribute__.
I prefer "direct" expression to hiding behind macros, unless there's a
reason for macros. A common reason is portability. Occasionally
abstraction, say when the direct expression doesn't really convey what
you're trying to do, or it's is overly verbose.
Anyway, I'm not particular on how we use attributes. Since you seem to
have more specific ideas, could you file suitable BiteSizedTasks?
next prev parent reply other threads:[~2017-02-02 10:22 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-31 16:14 [Qemu-trivial] [PATCH] Drop QEMU_GNUC_PREREQ() checks for gcc older than 4.1 Peter Maydell
2017-01-31 16:14 ` [Qemu-devel] " Peter Maydell
2017-01-31 16:55 ` [Qemu-trivial] " Daniel P. Berrange
2017-01-31 16:55 ` Daniel P. Berrange
2017-01-31 16:58 ` [Qemu-trivial] " Peter Maydell
2017-01-31 16:58 ` Peter Maydell
2017-01-31 23:27 ` [Qemu-trivial] " Paolo Bonzini
2017-01-31 23:27 ` Paolo Bonzini
2017-01-31 17:40 ` [Qemu-trivial] " Markus Armbruster
2017-01-31 17:40 ` Markus Armbruster
2017-01-31 18:00 ` [Qemu-trivial] " Peter Maydell
2017-01-31 18:00 ` Peter Maydell
2017-01-31 18:11 ` [Qemu-trivial] " Daniel P. Berrange
2017-01-31 18:11 ` Daniel P. Berrange
2017-01-31 18:32 ` [Qemu-trivial] " Peter Maydell
2017-01-31 18:32 ` Peter Maydell
2017-01-31 19:02 ` [Qemu-trivial] " Markus Armbruster
2017-01-31 19:02 ` Markus Armbruster
2017-01-31 18:58 ` [Qemu-trivial] " Markus Armbruster
2017-01-31 18:58 ` Markus Armbruster
2017-01-31 23:27 ` [Qemu-trivial] " Paolo Bonzini
2017-01-31 23:27 ` Paolo Bonzini
2017-02-01 6:49 ` [Qemu-trivial] " Markus Armbruster
2017-02-01 6:49 ` Markus Armbruster
2017-02-02 1:09 ` [Qemu-trivial] " Paolo Bonzini
2017-02-02 1:09 ` Paolo Bonzini
2017-02-02 10:17 ` Markus Armbruster [this message]
2017-02-02 10:17 ` Markus Armbruster
2017-04-21 9:08 ` [Qemu-trivial] " Peter Maydell
2017-04-21 9:08 ` Peter Maydell
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=87vass7v7x.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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.