From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f174.google.com (mail-wr0-f174.google.com [209.85.128.174]) by dpdk.org (Postfix) with ESMTP id 5FBF01B306 for ; Fri, 26 Jan 2018 18:39:46 +0100 (CET) Received: by mail-wr0-f174.google.com with SMTP id t16so1178003wrc.10 for ; Fri, 26 Jan 2018 09:39:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=HbuODdkSl0DMnVKhBHVwvbv5xoAfudN7+IPnZ8ycs4s=; b=qBccsvYBufOYOxc2RvUgU4ehMYlqMhg9X8g4jke3kwrUtMkKG7IUMq3be8+xU0AEzc KfXjeQQUi4u/Z5G9K6GxyHjc9Fp/2fT99QeigMIFI2//J7OkHYemOekNf34kEYKt9YnO v854dDdRSrTtQzG9BlarGpPFt1L5CIO7reqsgbpSQyUSyxCp9OwAeEWASFbLVZBr2BLG hB/XTXUlShZriwgseG8qeitIa2JjpKnhd0fN6mwjGq17UKgeyAqOIIVjLfTkGcliqgUO ZKYLRFfiPctu6+S2ARFMkBRzAZ8V3ogXVktgcyoNlV72MglSQVQdsHJzXpFSOtCahoKG 9zEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=HbuODdkSl0DMnVKhBHVwvbv5xoAfudN7+IPnZ8ycs4s=; b=s3MNNe6uNMwt+s/wN58FD+CqKIcl5muulop6JVgIL1zMpnSfVBLkdExuTofycA92EZ kn9QZGfvn1tAIgcOgdK8GJkayDJZLx1K7HjbVb1N7fn9qIgKkS4A2Xa6SZrwcxlhTfzf qmoEiZGdTFPYT43d/mI9n+adAyYf2XjV+dYr5NE1Po8vlOMoVbmO8jluzvNVShuj5cQJ d9jSYLPGriYs3bOR21f5FyU4Wnar0WWoCJ9YdjVwOoQ9AJyhlEIU8drnIF9L5pHvfT73 HHNZvN8wdOuwtNrAOue8lMuCed0cnXvivAC6tAOPQPIgaIuzjMBfwAaWWI0Gtv/aZlMW TGhw== X-Gm-Message-State: AKwxytexsx2Yg38tVRShOmC1LXef3quMUB/lgTZcZluJTnqThnsxroRG RDHx6W+rkRq8jtniaVG9weNdSA== X-Google-Smtp-Source: AH8x227EBiDzUSKOzqYjaZZ1ttKA27O0+xyb7gpN/YIxgyeIAw2uW9i3I38L+s1KLlmZc08p09flJg== X-Received: by 10.223.195.1 with SMTP id n1mr5851710wrf.130.1516988386077; Fri, 26 Jan 2018 09:39:46 -0800 (PST) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id j126sm4523959wmj.1.2018.01.26.09.39.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 09:39:45 -0800 (PST) Date: Fri, 26 Jan 2018 18:39:33 +0100 From: Adrien Mazarguil To: Thomas Monjalon Cc: Stephen Hemminger , "Patil, Harish" , "liang.j.ma@intel.com" , "peter.mccarthy@intel.com" , jerin.jacob@caviumnetworks.com, dev@dpdk.org, ferruh.yigit@intel.com Message-ID: <20180126173933.GB4256@6wind.com> References: <20236883.VkVyGBRfOF@xps> <20180121093458.082f4589@xeon-e3> <5211400.X7DXXCoju3@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5211400.X7DXXCoju3@xps> Subject: Re: [dpdk-dev] Compilation errors in drivers/event/opdl/ X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jan 2018 17:39:46 -0000 (Replying since you added me to this thread) On Sun, Jan 21, 2018 at 06:49:13PM +0100, Thomas Monjalon wrote: > 21/01/2018 18:34, Stephen Hemminger: > > On Sat, 20 Jan 2018 09:44:46 +0100 > > Thomas Monjalon wrote: > > > > > 20/01/2018 06:18, Patil, Harish: > > > > Hi, > > > > > > > > I am seeing below compilation errors in drivers/event/opdl/, this is with > > > > cloned latest DPDK (git clone http://dpdk.org/git/dpdk). > > > > > > > > .. > > > > .. > > > > /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta > > > > ts.c: In function ‘opdl_xstats_get_names’: > > > > /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta > > > > ts.c:89:2: error: ‘for’ loop initial declarations are only allowed in > > > > C99 mode > > > > for (uint32_t j = 0; j < max_num_port_xstat; j++) { > > > > ^ > > > > > > My compiler does not raise this error. > > > What is your compiler? > > > > > > Anyone to fix it QUICKLY please? today? > > > > > > Harish, do you think we should revert if not fixed? > > > > Using declaration in for loop is a C++ thing which was inherited into C99. > > Does DPDK require C99 mode? > > No DPDK is not generally C99. Except we use enough C99isms (named initializers anyone?) that I think it's safe to say DPDK won't ever compile in C90 mode. > > > Putting loop variables in for() looks better, but the rest of DPDK > > doesn't use that style. > > C99 was forced for this driver as a quick fix. > > Either the coding style guideline is updated to C99, > or this driver must be adapted to the DPDK coding style. > I have no strong opinion. When -std is not specified, depending on its version GCC defaults either to gnu90, gnu99 or gnu11, all based on the C standard in question with a number of GNU extensions. Named initializers typically never fail because they're otherwise part of the GNU extensions. Others such as the "for" declaration above apparently aren't considered part of gnu90. > Is C99 well supported in all compilers we want to use (including Windows)? If by Windows you mean MSVC, from memory (likely outdated) it's actually a C++ compiler that only provides limited support for C99, this fact will trigger many other issues. The above loop won't be one of them though. On the GCC/clang side, -std=gnu99 is what we assume in DPDK today without explicitly documenting it. Exported headers conform a stricter standard, they are compatible with -std=c99 with GNU extensions explicitly tagged whenever they can't be worked around. -- Adrien Mazarguil 6WIND