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 A8BA7423B9; Thu, 12 Jan 2023 18:04:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A64742D55; Thu, 12 Jan 2023 18:04:44 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3E54A42D4F for ; Thu, 12 Jan 2023 18:04:43 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 8842220DFDF6; Thu, 12 Jan 2023 09:04:42 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8842220DFDF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1673543082; bh=wfTs2PxAgC+BkRaaGPNlI3bvHWpL5fLmWX0N1Lq/skc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=R33EOkElUNQejOibLznJJjGpivnjIM3cFOg6GPopvR4KgKA2ZOs5kJCecZzQcRRVB 951l5Jb5q4iqriK36BYSjFUFr4/4iLJ3YjSVmfe2AVqRD9BlC48zw1VZF3yu8wSL95 VxfsmEtr5SyKw2gW0uyRaE4Iq6LcjmMxnYH3b5aY= Date: Thu, 12 Jan 2023 09:04:42 -0800 From: Tyler Retzlaff To: Bruce Richardson Cc: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com Subject: Re: [RFC PATCH 1/1] build: increase minimum C standard for DPDK builds Message-ID: <20230112170442.GA12479@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20230112113556.47485-1-bruce.richardson@intel.com> <20230112113556.47485-2-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230112113556.47485-2-bruce.richardson@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Thu, Jan 12, 2023 at 11:35:56AM +0000, Bruce Richardson wrote: > Set the default C language standard to be used for DPDK builds to C99. > This requires no actual code changes to build successfully. > > To ensure compatibility is kept for external apps using DPDK headers, we > explicitly set the build parameters for the chkincs binary to the old > minimum standard of "gnu89". [NOTE: DPDK code does not compile and has > previously not compiled for pure c89 standard, so that stricter > requirement need not be checked.] By adding this additional check, we > can separately manage C standards used internally in DPDK builds and > that required in the build flags for external apps using DPDK. > > Signed-off-by: Bruce Richardson > --- > buildtools/chkincs/meson.build | 1 + > meson.build | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build > index 378c2f19ef..322ac775ce 100644 > --- a/buildtools/chkincs/meson.build > +++ b/buildtools/chkincs/meson.build > @@ -30,6 +30,7 @@ executable('chkincs', sources, > c_args: cflags, > include_directories: includes, > dependencies: deps, > + override_options: 'c_std=gnu89', > install: false) > > # run tests for c++ builds also > diff --git a/meson.build b/meson.build > index f91d652bc5..9a2963cc16 100644 > --- a/meson.build > +++ b/meson.build > @@ -9,6 +9,7 @@ project('DPDK', 'C', > license: 'BSD', > default_options: [ > 'buildtype=release', > + 'c_std=c99', > 'default_library=static', > 'warning_level=2', > ], subject to the atomics abstraction proposal where a meson option is provided enable_stdatomics=true we'll want to be able to upgrade to -std=c11 / c_std=c11 (as a minimum). is there a meson mechanism that will let us evaluate that condition and specify the higher required standard version in default_options or is it a matter of some post project() or is this just done by adding -std=c11 using add_project_arguments() after project()? second, i think you will run into a build break with this change on some platform / compiler combinations. somewhere we are using strerror_r where the required posix versions are not specified in the translation unit worked around by using c_std=gnu99 or by adding appropriate undef GNUC etc.. in the place where strerror_r is used. (just something i noticed when testing a similar change during prototyping i think ubuntu 22.04?) going one step further i'd just ask that the default options be "portable" i.e. they work with ! gcc and ! clang to help me with future work. though i know that contradicts with my advice in the previous paragraph, maybe we can set c_std=xxx subject to toolchain/platform? Acked-by: Tyler Retzlaff