From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 8E4027D19 for ; Mon, 15 Jan 2018 17:18:50 +0100 (CET) Received: by mail-wm0-f46.google.com with SMTP id v71so3081201wmv.2 for ; Mon, 15 Jan 2018 08:18:50 -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=MhrNFq9lvTd1NfJLh8bgwn3dLgviCYOy38jjGikzJac=; b=NtzRpUbn4ylSucuLTKPi+3pvtadZn2k4vJbH3gT69Fz1AwiV3j0wmvZDiYWQFHmXt7 ViIgyiM4FkCn6e1jEINawUXYHXT/UtzY9nXYbNpt4P//h2DECFrvlXsdzFf3QnvOCeo/ eVhFxGpcyBAmDbQP8Xqy5rRiXG6kiSXIPhjZhx6pzfNRtx/uU9bwkFRb8XmvMfaxS3Xh 9PreXZ2mAZTJG+fJ3Bv5BA06b5SeJedbuT3Kvcy5IAEWsju/faJcv1eRj9nULXPnzu5u +Vn8wJ3ft54N/6zJs6ekgoZQdsv3dHBR+Ouh2IdA2sk3DSAQ00TVGw1Vu+KnONbhSBqp S8ZA== 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=MhrNFq9lvTd1NfJLh8bgwn3dLgviCYOy38jjGikzJac=; b=YkE8sTiu+ibaluUVsMzvJs6ljCP9qfPsVYyi16YFgHoz+jIZeNNSVo/9XR6S9jeQz2 QKBUU1OwgqHURL9zL7QaymAmQf8tyah6FFlUoblJYYzgU1MsHZbYDQyorzwos6IDu1ll shadFDWF6KGHvq6K2r5/mQSdkP6YIb4n+9JXBOmFU9KvO7lo+zCycCi4wtLIwi0gQPYH /3bNSwqzbEEzzTR5hz6KzDwC7enJmiiLy62b0/F4TC3agrjkcNCpdHYa/eH0DI/unmYZ Hc2NjUQ1Dc+TlZMlqZx0sdgPRDETNsNt6lN8cg9KmXwIoa7cC7Cr/Uh4SIaj7M+OK81c Ie7g== X-Gm-Message-State: AKwxytcen9gUUWqr0GnvN7Y1/jtU8xiDS/uVUpkLCKKm+6+thxZR+xqN +E2ouaclql9tHD7qjQnZwmJgUA== X-Google-Smtp-Source: ACJfBout7KORakffxXiHQA582d4gN6l/fMRMKaYuBKnj0+coZaT0b1yy9c0aPjrcp/d5gmW8g/v5Wg== X-Received: by 10.28.113.150 with SMTP id d22mr10523290wmi.127.1516033129942; Mon, 15 Jan 2018 08:18:49 -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 t4sm410201wmt.9.2018.01.15.08.18.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jan 2018 08:18:49 -0800 (PST) Date: Mon, 15 Jan 2018 17:18:37 +0100 From: Adrien Mazarguil To: Thomas Monjalon Cc: qian.q.xu@intel.com, dev@dpdk.org, hemant.agrawal@nxp.com, bruce.richardson@intel.com Message-ID: <20180115161837.GY4256@6wind.com> References: <13541534.8OkorCjPcv@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <13541534.8OkorCjPcv@xps> Subject: Re: [dpdk-dev] compilation error on Suse 11 - LPM init of anon union 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: Mon, 15 Jan 2018 16:18:50 -0000 On Sat, Jan 13, 2018 at 08:14:06PM +0100, Thomas Monjalon wrote: > Hi, > > There is a new compilation error since this commit in LPM: > http://dpdk.org/commit/b2e1c99 > The brace has been removed because unnecessary with anonymous union. > > This union is declared with RTE_STD_C11 for compatibility > with old compilers: > /** C extension macro for environments lacking C11 features. */ > #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L > #define RTE_STD_C11 __extension__ > #else > #define RTE_STD_C11 > #endif Yes, however not only for old compilers, e.g. explicitly specifying -std=c99 on the command-line disables C11 extensions for newer compilers as well. Not specifying anything (like most applications do) simply defaults to whatever standard is deemed "current" for it. In short, RTE_STD_C11 gets expanded as __extension__ when the compiler isn't in C11 mode, and what follows is therefore an extension to the standard in use (be it C90 or C99). __extension__ remains explicitly used in place of RTE_STD_C11 for things that are not even found in C11, namely GNU syntax extensions fall under this category. Keep in mind the __extension__ keyword is itself a GNU extension. > Unfortunately, it does not work on Suse 11 SP2 with GCC 4.5.1: > lib/librte_lpm/rte_lpm.c: In function ‘add_depth_big_v20’: > lib/librte_lpm/rte_lpm.c:886:4: error: > unknown field ‘group_idx’ specified in initializer > > Curiously, the error is exactly the same with ICC 16.0.2: > http://dpdk.org/ml/archives/test-report/2018-January/038443.html > Is it really using different compilers in those 2 tests? > > Someone to check the value of __STDC_VERSION__ with those compilers? > gcc -dM -E -xc /dev/null | grep STDC_VERSION > > Thanks for the help Since this problem only appears in big endian, my suggestion would be to add RTE_STD_C11 to the anonymous union of struct rte_lpm_tbl_entry_v20 (rte_lpm.h), like its little endian counterpart: #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN [...] RTE_STD_C11 union { uint8_t next_hop; uint8_t group_idx; }; [...] #else __extension__ struct rte_lpm_tbl_entry_v20 { uint8_t depth :6; uint8_t valid_group :1; uint8_t valid :1; RTE_STD_C11 // <<< Should be added here union { uint8_t group_idx; uint8_t next_hop; }; }; I don't have the adequate test environment to validate this, so please report if it helps and/or submit a patch, thanks. -- Adrien Mazarguil 6WIND