From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 27AA7A2F for ; Tue, 10 Nov 2015 17:21:14 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 10 Nov 2015 08:21:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,271,1444719600"; d="scan'208";a="682253630" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga003.jf.intel.com with ESMTP; 10 Nov 2015 08:21:11 -0800 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.13]) by IRSMSX101.ger.corp.intel.com ([163.33.3.153]) with mapi id 14.03.0248.002; Tue, 10 Nov 2015 16:21:11 +0000 From: "Richardson, Bruce" To: Adrien Mazarguil Thread-Topic: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header Thread-Index: AQHRFi9frvNHb8RAG0uWI1YANX292Z6LEV0AgACYMACAAIp8gIABV3oAgAG0FoCAAANygIAEeJaAgAADEnCAAbjmAIAAAnDw Date: Tue, 10 Nov 2015 16:21:10 +0000 Message-ID: <59AF69C657FD0841A61C55336867B5B035981593@IRSMSX103.ger.corp.intel.com> References: <1446552059-5446-1-git-send-email-bruce.richardson@intel.com> <1446552059-5446-3-git-send-email-bruce.richardson@intel.com> <4698587.GS9blBozDC@xps13> <20151104102418.GN3518@6wind.com> <20151104103957.4cabd090@xeon-e3> <20151105150918.GV3518@6wind.com> <20151106171007.GB19512@bricha3-MOBL3> <20151106172227.GC19512@bricha3-MOBL3> <20151109133905.GL4013@6wind.com> <59AF69C657FD0841A61C55336867B5B03598018B@IRSMSX103.ger.corp.intel.com> <20151110160806.GV4013@6wind.com> In-Reply-To: <20151110160806.GV4013@6wind.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2015 16:21:14 -0000 > -----Original Message----- > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > Sent: Tuesday, November 10, 2015 4:08 PM > To: Richardson, Bruce > Cc: Stephen Hemminger ; Thomas Monjalon > ; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros > to header >=20 > 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 th= e > -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. >=20 > Right, -pedantic must follow a given standard such as -std=3Dgnu99 otherw= ise > it's meaningless. >=20 > However pre-GCC 5 is fine for most if not all features we use, see: >=20 > https://gcc.gnu.org/c99status.html >=20 > 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 lon= g > as we use a version that implements -std=3Dgnu99 (or -std=3Dc99 to be rea= lly > pedantic), it's fine. >=20 > 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. >=20 > -- > Adrien Mazarguil > 6WIND Actually my point was slightly different.=20 If we are supporting "-pedantic" in header files because "we don't know wha= t 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 co= de 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 m= acros at all.=20 This limits the usefulness of supporting pedantic flag at all in our header= files, since we only support it in certain situations with non-latest comp= ilers. /Bruce