Skip to content

Commit 33d6694

Browse files
bruce-richardsondavid-marchand
authored andcommitted
build: use C11 standard
As previously announced, DPDK 23.11 will require a C11 supporting compiler and will use the C11 standard in all builds. Forcing use of the C standard, rather than the standard with GNU extensions, means that some posix definitions which are not in the C standard are unavailable by default. We fix this by ensuring the correct defines or cflags are passed to the components that need them. Signed-off-by: Bruce Richardson <[email protected]> Acked-by: Morten Brørup <[email protected]> Acked-by: Tyler Retzlaff <[email protected]> Tested-by: Ali Alnubani <[email protected]>
1 parent 0ae35ec commit 33d6694

File tree

9 files changed

+28
-26
lines changed

9 files changed

+28
-26
lines changed

doc/guides/linux_gsg/sys_reqs.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ Compilation of the DPDK
2727
The setup commands and installed packages needed on various systems may be different.
2828
For details on Linux distributions and the versions tested, please consult the DPDK Release Notes.
2929

30-
* General development tools including a supported C compiler such as gcc (version 4.9+) or clang (version 3.4+),
30+
* General development tools including a C compiler supporting the C11 standard,
31+
including standard atomics, for example: GCC (version 5.0+) or Clang (version 3.6+),
3132
and ``pkg-config`` or ``pkgconf`` to be used when building end-user binaries against DPDK.
3233

3334
* For RHEL/Fedora systems these can be installed using ``dnf groupinstall "Development Tools"``

doc/guides/rel_notes/deprecation.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,6 @@ Other API and ABI deprecation notices are to be posted below.
1717
Deprecation Notices
1818
-------------------
1919

20-
* C Compiler: From DPDK 23.11 onwards,
21-
building DPDK will require a C compiler which supports the C11 standard,
22-
including support for C11 standard atomics.
23-
24-
More specifically, the requirements will be:
25-
26-
* Support for flag "-std=c11" (or similar)
27-
* __STDC_NO_ATOMICS__ is *not defined* when using c11 flag
28-
29-
Please note:
30-
31-
* C11, including standard atomics, is supported from GCC version 5 onwards,
32-
and is the default language version in that release
33-
(Ref: https://gcc.gnu.org/gcc-5/changes.html)
34-
* C11 is the default compilation mode in Clang from version 3.6,
35-
which also added support for standard atomics
36-
(Ref: https://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html)
37-
3820
* build: Enabling deprecated libraries (``flow_classify``, ``kni``)
3921
won't be possible anymore through the use of the ``disable_libs`` build option.
4022
A new build option for deprecated libraries will be introduced instead.

doc/guides/rel_notes/release_23_11.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,23 @@ DPDK Release 23.11
2020
ninja -C build doc
2121
xdg-open build/doc/guides/html/rel_notes/release_23_11.html
2222
23+
* Build Requirements: From DPDK 23.11 onwards,
24+
building DPDK will require a C compiler which supports the C11 standard,
25+
including support for C11 standard atomics.
26+
27+
More specifically, the requirements will be:
28+
29+
* Support for flag "-std=c11" (or similar)
30+
* __STDC_NO_ATOMICS__ is *not defined* when using c11 flag
31+
32+
Please note:
33+
34+
* C11, including standard atomics, is supported from GCC version 5 onwards,
35+
and is the default language version in that release
36+
(Ref: https://gcc.gnu.org/gcc-5/changes.html)
37+
* C11 is the default compilation mode in Clang from version 3.6,
38+
which also added support for standard atomics
39+
(Ref: https://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html)
2340

2441
New Features
2542
------------

drivers/common/mlx5/linux/meson.build

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,12 @@ if libmtcr_ul_found
231231
endif
232232

233233
foreach arg:has_sym_args
234-
mlx5_config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], dependencies: libs))
234+
mlx5_config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], dependencies: libs, args: cflags))
235235
endforeach
236236
foreach arg:has_member_args
237237
file_prefix = '#include <' + arg[1] + '>'
238-
mlx5_config.set(arg[0], cc.has_member(arg[2], arg[3], prefix : file_prefix, dependencies: libs))
238+
mlx5_config.set(arg[0],
239+
cc.has_member(arg[2], arg[3], prefix : file_prefix, dependencies: libs, args: cflags))
239240
endforeach
240241

241242
# Build Glue Library

drivers/net/failsafe/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ if is_windows
77
subdir_done()
88
endif
99

10-
cflags += '-std=gnu99'
1110
cflags += '-D_DEFAULT_SOURCE'
1211
cflags += '-D_XOPEN_SOURCE=700'
1312
cflags += '-pedantic'

drivers/net/mlx4/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ has_sym_args = [
103103
config = configuration_data()
104104
foreach arg:has_sym_args
105105
config.set(arg[0], cc.has_header_symbol(arg[1], arg[2],
106-
dependencies: libs))
106+
dependencies: libs, args: cflags))
107107
endforeach
108108
foreach arg:has_member_args
109109
file_prefix = '#include <' + arg[1] + '>'
110110
config.set(arg[0], cc.has_member(arg[2], arg[3],
111-
prefix: file_prefix, dependencies: libs))
111+
prefix: file_prefix, dependencies: libs, args: cflags))
112112
endforeach
113113
configure_file(output : 'mlx4_autoconf.h', configuration : config)
114114

lib/acl/acl_run_altivec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ resolve_priority_altivec(uint64_t transition, int n,
4141
{
4242
uint32_t x;
4343
xmm_t results, priority, results1, priority1;
44-
__vector bool int selector;
44+
__vector __bool int selector;
4545
xmm_t *saved_results, *saved_priority;
4646

4747
for (x = 0; x < categories; x += RTE_ACL_RESULTS_MULTIPLIER) {
@@ -110,7 +110,7 @@ transition4(xmm_t next_input, const uint64_t *trans,
110110
xmm_t in, node_type, r, t;
111111
xmm_t dfa_ofs, quad_ofs;
112112
xmm_t *index_mask, *tp;
113-
__vector bool int dfa_msk;
113+
__vector __bool int dfa_msk;
114114
__vector signed char zeroes = {};
115115
union {
116116
uint64_t d64[2];

lib/eal/common/eal_common_errno.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
/* Use XSI-compliant portable version of strerror_r() */
66
#undef _GNU_SOURCE
7+
#define _POSIX_C_SOURCE 200809L
78

89
#include <stdio.h>
910
#include <string.h>

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ project('DPDK', 'c',
99
license: 'BSD',
1010
default_options: [
1111
'buildtype=release',
12+
'c_std=c11',
1213
'default_library=static',
1314
'warning_level=2',
1415
],

0 commit comments

Comments
 (0)