From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8FF6042F90; Wed, 2 Aug 2023 14:31:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C61140DDB; Wed, 2 Aug 2023 14:31:53 +0200 (CEST) Received: from mgamail.intel.com (unknown [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id DD2214021D for ; Wed, 2 Aug 2023 14:31:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690979511; x=1722515511; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OK9R5EdVYhblh+g44h+Ur7kH4ULUbLjHbtCoZmKr/Gs=; b=Pybd1JJbINkTx8qZlZLPeFJFYrYKVRXgQ5ESVJ3kwI1Q88qk2VCiESyp PCQjAOO1HoDtdLjUV1vfTPHU71V79fhuyWw8FGBLjzTV8KYPFdeXhTZFN FhLROBZGoKGnwdoVcpFrQy1VOcMFTppyQHT5LcxS46Gn7OsDBYLo8Nqu9 1hXKG4tw9Ol8JSOQ/fqYn8M3MLy0vsGh9ObHRaN3wibSrwTmJtEKFIGLI FVjLHf3H19piZ3ZxBh+j0m9K9uCL4v3mjdYVghr0tE7dKH4P5EiBZHnM/ SuuI0TI9gum9Fv3WxmAoq3+2nW0fguX10jHkJ5NlrsFx232KlA062jCvm g==; X-IronPort-AV: E=McAfee;i="6600,9927,10789"; a="372296752" X-IronPort-AV: E=Sophos;i="6.01,249,1684825200"; d="scan'208";a="372296752" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 05:31:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10789"; a="758734730" X-IronPort-AV: E=Sophos;i="6.01,249,1684825200"; d="scan'208";a="758734730" Received: from silpixa00401385.ir.intel.com ([10.237.214.162]) by orsmga008.jf.intel.com with ESMTP; 02 Aug 2023 05:31:41 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Tyler Retzlaff Subject: [PATCH v5] build: update DPDK to use C11 standard Date: Wed, 2 Aug 2023 13:31:34 +0100 Message-Id: <20230802123134.370199-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230731103858.1491751-1-bruce.richardson@intel.com> References: <20230731103858.1491751-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- V5: * Fix build issues with bool type in altivec code, due to bool type being in C11. Use __bool for altivec-specific version instead. V4: * pass cflags to the structure and definition checks in mlx* drivers to ensure posix definitions - as well as C-standard ones - are available. V3: * remove (now unneeded) use of -std=gnu99 in failsafe net driver. V2: * Resubmit now that 23.11-rc0 patch applied * Add _POSIX_C_SOURCE macro to eal_common_errno.c to get POSIX definition of strerror_r() with c11 standard. --- doc/guides/linux_gsg/sys_reqs.rst | 3 ++- doc/guides/rel_notes/deprecation.rst | 18 ------------------ doc/guides/rel_notes/release_23_11.rst | 17 +++++++++++++++++ drivers/common/mlx5/linux/meson.build | 5 +++-- drivers/net/failsafe/meson.build | 1 - drivers/net/mlx4/meson.build | 4 ++-- lib/acl/acl_run_altivec.h | 4 ++-- lib/eal/common/eal_common_errno.c | 1 + meson.build | 1 + 9 files changed, 28 insertions(+), 26 deletions(-) diff --git a/doc/guides/linux_gsg/sys_reqs.rst b/doc/guides/linux_gsg/sys_reqs.rst index dfeaf4e1c5..13be715933 100644 --- a/doc/guides/linux_gsg/sys_reqs.rst +++ b/doc/guides/linux_gsg/sys_reqs.rst @@ -27,7 +27,8 @@ Compilation of the DPDK The setup commands and installed packages needed on various systems may be different. For details on Linux distributions and the versions tested, please consult the DPDK Release Notes. -* General development tools including a supported C compiler such as gcc (version 4.9+) or clang (version 3.4+), +* General development tools including a C compiler supporting the C11 standard, + including standard atomics, for example: GCC (version 5.0+) or Clang (version 3.6+), and ``pkg-config`` or ``pkgconf`` to be used when building end-user binaries against DPDK. * For RHEL/Fedora systems these can be installed using ``dnf groupinstall "Development Tools"`` diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 494b401cda..cc939d3c67 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -17,24 +17,6 @@ Other API and ABI deprecation notices are to be posted below. Deprecation Notices ------------------- -* C Compiler: From DPDK 23.11 onwards, - building DPDK will require a C compiler which supports the C11 standard, - including support for C11 standard atomics. - - More specifically, the requirements will be: - - * Support for flag "-std=c11" (or similar) - * __STDC_NO_ATOMICS__ is *not defined* when using c11 flag - - Please note: - - * C11, including standard atomics, is supported from GCC version 5 onwards, - and is the default language version in that release - (Ref: https://gcc.gnu.org/gcc-5/changes.html) - * C11 is the default compilation mode in Clang from version 3.6, - which also added support for standard atomics - (Ref: https://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html) - * build: Enabling deprecated libraries (``flow_classify``, ``kni``) won't be possible anymore through the use of the ``disable_libs`` build option. A new build option for deprecated libraries will be introduced instead. diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index 6b4dd21fd0..c8b9ed456c 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -20,6 +20,23 @@ DPDK Release 23.11 ninja -C build doc xdg-open build/doc/guides/html/rel_notes/release_23_11.html +* Build Requirements: From DPDK 23.11 onwards, + building DPDK will require a C compiler which supports the C11 standard, + including support for C11 standard atomics. + + More specifically, the requirements will be: + + * Support for flag "-std=c11" (or similar) + * __STDC_NO_ATOMICS__ is *not defined* when using c11 flag + + Please note: + + * C11, including standard atomics, is supported from GCC version 5 onwards, + and is the default language version in that release + (Ref: https://gcc.gnu.org/gcc-5/changes.html) + * C11 is the default compilation mode in Clang from version 3.6, + which also added support for standard atomics + (Ref: https://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html) New Features ------------ diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build index 15edc13041..b3a64547c5 100644 --- a/drivers/common/mlx5/linux/meson.build +++ b/drivers/common/mlx5/linux/meson.build @@ -231,11 +231,12 @@ if libmtcr_ul_found endif foreach arg:has_sym_args - mlx5_config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], dependencies: libs)) + mlx5_config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], dependencies: libs, args: cflags)) endforeach foreach arg:has_member_args file_prefix = '#include <' + arg[1] + '>' - mlx5_config.set(arg[0], cc.has_member(arg[2], arg[3], prefix : file_prefix, dependencies: libs)) + mlx5_config.set(arg[0], + cc.has_member(arg[2], arg[3], prefix : file_prefix, dependencies: libs, args: cflags)) endforeach # Build Glue Library diff --git a/drivers/net/failsafe/meson.build b/drivers/net/failsafe/meson.build index 6013e13722..c1d361083b 100644 --- a/drivers/net/failsafe/meson.build +++ b/drivers/net/failsafe/meson.build @@ -7,7 +7,6 @@ if is_windows subdir_done() endif -cflags += '-std=gnu99' cflags += '-D_DEFAULT_SOURCE' cflags += '-D_XOPEN_SOURCE=700' cflags += '-pedantic' diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index a038c1ec1b..3c5ee24186 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -103,12 +103,12 @@ has_sym_args = [ config = configuration_data() foreach arg:has_sym_args config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], - dependencies: libs)) + dependencies: libs, args: cflags)) endforeach foreach arg:has_member_args file_prefix = '#include <' + arg[1] + '>' config.set(arg[0], cc.has_member(arg[2], arg[3], - prefix: file_prefix, dependencies: libs)) + prefix: file_prefix, dependencies: libs, args: cflags)) endforeach configure_file(output : 'mlx4_autoconf.h', configuration : config) diff --git a/lib/acl/acl_run_altivec.h b/lib/acl/acl_run_altivec.h index 4556e1503b..3c30466d2d 100644 --- a/lib/acl/acl_run_altivec.h +++ b/lib/acl/acl_run_altivec.h @@ -41,7 +41,7 @@ resolve_priority_altivec(uint64_t transition, int n, { uint32_t x; xmm_t results, priority, results1, priority1; - __vector bool int selector; + __vector __bool int selector; xmm_t *saved_results, *saved_priority; for (x = 0; x < categories; x += RTE_ACL_RESULTS_MULTIPLIER) { @@ -110,7 +110,7 @@ transition4(xmm_t next_input, const uint64_t *trans, xmm_t in, node_type, r, t; xmm_t dfa_ofs, quad_ofs; xmm_t *index_mask, *tp; - __vector bool int dfa_msk; + __vector __bool int dfa_msk; __vector signed char zeroes = {}; union { uint64_t d64[2]; diff --git a/lib/eal/common/eal_common_errno.c b/lib/eal/common/eal_common_errno.c index ef8f782abb..b30e2f0ad4 100644 --- a/lib/eal/common/eal_common_errno.c +++ b/lib/eal/common/eal_common_errno.c @@ -4,6 +4,7 @@ /* Use XSI-compliant portable version of strerror_r() */ #undef _GNU_SOURCE +#define _POSIX_C_SOURCE 200809L #include #include diff --git a/meson.build b/meson.build index 39cb73846d..70b54f0c98 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,7 @@ project('DPDK', 'c', license: 'BSD', default_options: [ 'buildtype=release', + 'c_std=c11', 'default_library=static', 'warning_level=2', ], -- 2.39.2