[dpdk-dev] [PATCH v2 00/11] Fix build errors related to exported headers

Adrien Mazarguil adrien.mazarguil at 6wind.com
Tue Jul 5 14:37:00 CEST 2016


On Tue, Jul 05, 2016 at 12:27:06PM +0100, Ferruh Yigit wrote:
> On 7/5/2016 11:44 AM, Adrien Mazarguil wrote:
> > DPDK uses GNU C language extensions in most of its code base. This is fine
> > for internal source files whose compilation flags are controlled by DPDK,
> > however user applications that use exported "public" headers may experience
> > compilation failures when enabling strict error/standard checks (-std and
> > -pedantic for instance).
> 
> Out of curiosity, is there a specific standard version that is targeted?

Considering past discussions on more or less related topics (such as [1]), I
think we target at least C99 compliance for exported headers only. It can be
even better if we manage to have them comply with C90 but I think it is not
worth the effort, as all the compilers we support do understand C99. C11
support is not widespread enough yet.

Note that even after applying this series, exported headers are not really
C99 compliant. Extensions are only made clear through the use of
__extension__ keywords (and a few minor changes) that non-compliant
statements are perfectly normal and compilers should not worry about them
when compiling user applications with stricter flags than usual (-pedantic).

Remember that the rest of DPDK can use whatever internally without explicit
keywords as long as it works with the default set of options and all
supported compiler versions for targetted platforms. This series does not
change anything in this regard.

Also C++ compat is on currently only on a best effort basis. Works as long
as -pedantic is not specified, that is a task for later if we really want
full compliance.

In short:

- Exported headers: C99, C++11 (best effort)
- Internally: GNU C99/C11, no C++ (but I guess it would be C++11 considering
  the number of extensions we'd need otherwise).

[1] http://dpdk.org/ml/archives/dev/2015-November/027355.html

-- 
Adrien Mazarguil
6WIND


More information about the dev mailing list