From: Bruce Richardson <bruce.richardson@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
Thomas Monjalon <thomas.monjalon@6wind.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header
Date: Wed, 11 Nov 2015 10:51:51 +0000 [thread overview]
Message-ID: <20151111105151.GB31936@bricha3-MOBL3> (raw)
In-Reply-To: <20151110171228.GY4013@6wind.com>
On Tue, Nov 10, 2015 at 06:12:28PM +0100, Adrien Mazarguil wrote:
> On Tue, Nov 10, 2015 at 04:21:10PM +0000, Richardson, Bruce wrote:
> >
> >
> > > -----Original Message-----
> > > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com]
> > > Sent: Tuesday, November 10, 2015 4:08 PM
> > > To: Richardson, Bruce <bruce.richardson@intel.com>
> > > Cc: Stephen Hemminger <stephen@networkplumber.org>; Thomas Monjalon
> > > <thomas.monjalon@6wind.com>; dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros
> > > to header
> > >
> > > On Mon, Nov 09, 2015 at 02:02:28PM +0000, Richardson, Bruce wrote:
> > > [...]
> > > > > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com]
> > > [...]
> > > > > Untested but I guess modifying that function accordingly would look
> > > like:
> > > > >
> > > > > static inline void
> > > > > rte_pmd_debug_trace(const char *func_name, const char *fmt, ...) {
> > > > > va_list ap;
> > > > > va_start(ap, fmt);
> > > > >
> > > > > static __thread char buffer[vsnprintf(NULL, 0, fmt, ap)];
> > > > >
> > > > > va_end(ap);
> > > > > va_start(ap, fmt);
> > > > > vsnprintf(buffer, sizeof(buffer), fmt, ap);
> > > > > va_end(ap);
> > > > > rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name,
> > > > > buffer); }
> > > > >
> > > >
> > > > Looks a much better option.
> > > >
> > > > From this, though, I assume then that we are only looking to support the
> > > -pedantic flag in conjuction with c99 mode or above. Supporting -pedantic
> > > with the pre-gcc-5 versions won't allow that to work though, as variably
> > > sized arrays only came in with c99, and were gnu extensions before that.
> > >
> > > Right, -pedantic must follow a given standard such as -std=gnu99 otherwise
> > > it's meaningless.
> > >
> > > However pre-GCC 5 is fine for most if not all features we use, see:
> > >
> > > https://gcc.gnu.org/c99status.html
> > >
> > > Mixed code and declarations are supported since GCC 3.0, __VA_ARGS__ in
> > > macros since GCC 2.95 and variable length arrays since GCC 0.9, so as long
> > > as we use a version that implements -std=gnu99 (or -std=c99 to be really
> > > pedantic), it's fine.
> > >
> > > Besides DPDK already uses C99 extensively, even a few C11 features (such
> > > as
> > > embedded anonymous struct definitions) currently supported in C99 mode as
> > > compiler extensions. I think we can safely ignore compilers that don't
> > > support common C99 features.
> > >
> > > --
> > > Adrien Mazarguil
> > > 6WIND
> >
> > Actually my point was slightly different.
> > If we are supporting "-pedantic" in header files because "we don't know what compiler flags users are going to pass when", then we need to support it in C90 mode to do the job properly. If you take gcc 4.8 and compile some code with "-pedantic" as the only C-flag you are going to get lots of errors because it will default to C90 mode with pedantic, which means no varargs macros at all.
>
> Agreed, exported headers should actually be C90 compliant for these reasons
> but C99 would be a start. I didn't know GCC 5 switched to C99 by default
> (don't worry, I do not intend to go back to C90).
>
Actually, it's even better than C99, the default is now C11 (or gnu11 to be pedantic about it :-) )
https://gcc.gnu.org/gcc-5/changes.html
Top line item is:
"The default mode for C is now -std=gnu11 instead of -std=gnu89"
I believe clang is making a similar change to a c11-based default. \o/
/Bruce
next prev parent reply other threads:[~2015-11-11 10:52 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-12 11:28 [dpdk-dev] [PATCH 0/4] ethdev: Add checks for function support in driver Bruce Richardson
2015-06-12 11:28 ` [dpdk-dev] [PATCH 1/4] ethdev: rename macros to have RTE_ETH prefix Bruce Richardson
2015-06-12 11:28 ` [dpdk-dev] [PATCH 2/4] ethdev: move RTE_ETH_FPTR_OR_ERR macros to header Bruce Richardson
2015-06-12 11:28 ` [dpdk-dev] [PATCH 3/4] ethdev: remove duplicated debug functions Bruce Richardson
2015-06-12 11:28 ` [dpdk-dev] [PATCH 4/4] ethdev: check support for rx_queue_count and descriptor_done fns Bruce Richardson
2015-06-12 17:32 ` Roger B. Melton
2015-06-15 10:14 ` Bruce Richardson
2015-07-06 15:11 ` Thomas Monjalon
2015-07-26 20:44 ` Thomas Monjalon
2015-09-09 15:09 ` [dpdk-dev] [PATCH v2 0/4] ethdev: minor cleanup Bruce Richardson
2015-09-09 15:09 ` [dpdk-dev] [PATCH v2 1/4] ethdev: rename macros to have RTE_ETH prefix Bruce Richardson
2015-09-09 15:09 ` [dpdk-dev] [PATCH v2 2/4] ethdev: move error checking macros to header Bruce Richardson
2015-09-09 15:09 ` [dpdk-dev] [PATCH v2 3/4] ethdev: remove duplicated debug functions Bruce Richardson
2015-09-09 15:09 ` [dpdk-dev] [PATCH v2 4/4] ethdev: check driver support for functions Bruce Richardson
2015-09-28 10:23 ` [dpdk-dev] [PATCH v2 0/4] ethdev: minor cleanup Bruce Richardson
2015-11-03 1:11 ` Thomas Monjalon
2015-11-03 10:06 ` Bruce Richardson
2015-11-03 12:00 ` [dpdk-dev] [PATCH v3 " Bruce Richardson
2015-11-03 12:00 ` [dpdk-dev] [PATCH v3 1/4] ethdev: rename macros to have RTE_ETH prefix Bruce Richardson
2015-11-03 12:00 ` [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header Bruce Richardson
2015-11-04 1:19 ` Thomas Monjalon
2015-11-04 10:24 ` Adrien Mazarguil
2015-11-04 14:10 ` Bruce Richardson
2015-11-04 15:25 ` Adrien Mazarguil
2015-11-04 18:39 ` Stephen Hemminger
2015-11-05 15:09 ` Adrien Mazarguil
2015-11-05 15:17 ` Bruce Richardson
2015-11-06 11:49 ` Bruce Richardson
2015-11-06 17:10 ` Bruce Richardson
2015-11-06 17:22 ` Bruce Richardson
2015-11-09 13:39 ` Adrien Mazarguil
2015-11-09 13:50 ` Adrien Mazarguil
2015-11-09 14:02 ` Richardson, Bruce
2015-11-10 10:31 ` Declan Doherty
2015-11-10 16:08 ` Adrien Mazarguil
2015-11-10 16:21 ` Richardson, Bruce
2015-11-10 17:12 ` Adrien Mazarguil
2015-11-11 10:51 ` Bruce Richardson [this message]
2015-11-03 12:00 ` [dpdk-dev] [PATCH v3 3/4] ethdev: remove duplicated debug functions Bruce Richardson
2015-11-03 12:00 ` [dpdk-dev] [PATCH v3 4/4] ethdev: check driver support for functions Bruce Richardson
2015-11-03 22:00 ` Stephen Hemminger
2015-11-04 14:15 ` Bruce Richardson
2015-11-17 12:21 ` [dpdk-dev] [PATCH v4 0/2] ethdev: debug code cleanup Bruce Richardson
2015-11-17 12:21 ` [dpdk-dev] [PATCH v4 1/2] ethdev: remove duplicated debug functions Bruce Richardson
2015-11-17 12:21 ` [dpdk-dev] [PATCH v4 2/2] ethdev: add sanity checks to functions Bruce Richardson
2015-11-17 15:53 ` Stephen Hemminger
2015-11-24 14:56 ` Bruce Richardson
2015-11-24 15:29 ` Thomas Monjalon
2015-11-24 15:45 ` Bruce Richardson
2015-11-24 15:48 ` Thomas Monjalon
2015-11-24 17:37 ` [dpdk-dev] [PATCH v5 0/2] ethdev: debug code cleanup Bruce Richardson
2015-11-24 17:37 ` [dpdk-dev] [PATCH v5 1/2] ethdev: remove duplicated debug functions Bruce Richardson
2015-11-25 18:14 ` Thomas Monjalon
2015-11-24 17:37 ` [dpdk-dev] [PATCH v5 2/2] ethdev: add sanity checks to functions Bruce Richardson
2015-11-25 18:21 ` [dpdk-dev] [PATCH v5 0/2] ethdev: debug code cleanup Thomas Monjalon
2015-11-06 11:52 [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header Bruce Richardson
2015-11-06 12:25 ` Adrien Mazarguil
2015-11-06 14:39 ` Richardson, Bruce
2015-11-06 14:54 ` Adrien Mazarguil
2015-11-06 15:30 ` Richardson, Bruce
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=20151111105151.GB31936@bricha3-MOBL3 \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas.monjalon@6wind.com \
/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).