DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: "Morten Brørup" <mb@smartsharesystems.com>, dev@dpdk.org
Subject: Re: [PATCH] eal: provide rte attribute macro for GCC attribute
Date: Tue, 20 Feb 2024 09:50:43 -0800	[thread overview]
Message-ID: <20240220175043.GA19214@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> (raw)
In-Reply-To: <4204295.tIAgqjz4sF@thomas>

On Sun, Feb 18, 2024 at 05:44:48PM +0100, Thomas Monjalon wrote:
> 18/02/2024 17:38, Morten Brørup:
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > Sent: Sunday, 18 February 2024 16.35
> > > 
> > > 18/02/2024 13:53, Morten Brørup:
> > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > Sent: Sunday, 18 February 2024 13.24
> > > > >
> > > > > 15/02/2024 23:20, Tyler Retzlaff:
> > > > > > Provide a new macro __rte_attribute(a) that when directly used
> > > > > > compiles to empty for MSVC and to __attribute__(a) when using
> > > > > GCC/LLVM.
> > > > > >
> > > > > > Replace direct use of __attribute__ in __rte_xxx macros where
> > > there
> > > > > is
> > > > > > existing empty expansion of the macro for MSVC allowing removal
> > > of
> > > > > > repeated #ifdef RTE_TOOLCHAIN_MSVC per macro to expand empty.
> > > > >
> > > > > I'm not sure it makes sense.
> > > > > I prefer seeing clearly what is empty with MSVC.
> > > >
> > > > This topic has previously been discussed in another context - adding
> > > external libraries [1].
> > > >
> > > > Like you do here, I generally preferred #ifdefs in the code, but the
> > > majority preferred stubs "promoting improved code readability".
> > > 
> > > Stubs may make sense in many places,
> > > but here we are talking about rte_common.h
> > > where we abstract differences between arch and compilers,
> > > so it is the right place to be explicit with compilers support.
> > 
> > Very strong point. I'm convinced.
> > 
> > Should the new rte_attribute() macro still be introduced for other uses of __attribute__(), e.g. the somewhat exotic attributes in eal/include/rte_lock_annotations.h?
> 
> They are all wrapped in a meaningful macro.
> 
> > The not-so-exotic attributes could have new macros added, e.g. __rte_const and __rte_pure.
> 
> Yes we need wrappers for all attributes.

These are my expectation of what is supposed to be done based on the
comments in checkpatches.sh. The intention would be that
__rte__attribute not be directly used outside of rte_common.h (as is
required for __attribute__).

Introducing __rte_attribute was an attempt by me to appease previous
complaints of there being a conditional MSVC check for many macros which
was triggered by finding bare use of __attribute__ elsewhere
contradicting what was commented in checkpatches.sh

> 
> 
> > > > I might argue that Tyler is following that guidance here; and perhaps
> > > the decision should be reconsidered, now that we have a real-life
> > > example of how it affects code readability. ;-)
> > > >
> > > > [1]: https://inbox.dpdk.org/dev/20240109141009.497807-1-
> > > jerinj@marvell.com/
> 
> 

  reply	other threads:[~2024-02-20 17:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 22:20 [PATCH] remove some MSVC conditional compile to empty Tyler Retzlaff
2024-02-15 22:20 ` [PATCH] eal: provide rte attribute macro for GCC attribute Tyler Retzlaff
2024-02-18 12:24   ` Thomas Monjalon
2024-02-18 12:53     ` Morten Brørup
2024-02-18 15:34       ` Thomas Monjalon
2024-02-18 16:38         ` Morten Brørup
2024-02-18 16:44           ` Thomas Monjalon
2024-02-20 17:50             ` Tyler Retzlaff [this message]
2024-02-18 14:51     ` Mattias Rönnblom
2024-02-18 15:31       ` Thomas Monjalon
2024-02-20 18:06         ` Tyler Retzlaff
2024-02-20 18:27           ` Thomas Monjalon
2024-02-27 22:45 ` [PATCH] remove some MSVC conditional compile to empty Tyler Retzlaff

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=20240220175043.GA19214@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net \
    --to=roretzla@linux.microsoft.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --cc=thomas@monjalon.net \
    /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).