From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 000432BD1 for ; Fri, 16 Jun 2017 14:19:30 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id u195so10459037wmd.1 for ; Fri, 16 Jun 2017 05:19:30 -0700 (PDT) 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:in-reply-to; bh=XU9e1jEv/kQnyUnQP7yFyOPLLVMROaOs7IMTTsiNFHM=; b=ItaS0VPJOg7tiaeeiwJhHgUMRA8NTT8NcPHE0LmXuXmuZ3vhMywekSsC5YusCAQskf GT9DIVCg0kmr2jEEjpUXxuxfDfP6wiSKtZLrM3H8TYMksQXaSCCsS2wxq11veKMVatVv WhdO/g1kPC57+AgZ5knYvFoMatNuMhCeapSvXpCx2rjTGmCIQg7vJLUsfRs97TTMqjrE W8Sfe1wyP7Ehd98mvtHyWI9JCIYahEPOm3RFB4WuF2w/0yvHXx4SzcZnnvP0LC9U+YkX rmDV0eCiTiYGM16WR8MeIxZiE84b31iBgS5Z10InHkYDgJGCg6ra3tVdeMEKKucjWuy2 YQog== 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:in-reply-to; bh=XU9e1jEv/kQnyUnQP7yFyOPLLVMROaOs7IMTTsiNFHM=; b=JmRL1l0fiIXIayU/DnyGdsOw5ahuXWTZVoDuLGGvqILmgR17cb619/CepsUwCRD+a5 Zsh49dnH5/uM0NOzRMLkUsYPPhJY9GjS1wg6QTOVVtfvvYJwCEnRqHAyCpifYGVDI7dr WqyEpd2IfPFj0J+GJXU6Yct4oxmk3P019Q0uosebwh6UBPxLQzFKG8J7YCENET97JBcT ov6pRw9G5RvMS9y4NN+RXZJZX4rXz+15F0gga+qIwIX0DIWL/SPG/QzapQS0c6wInGr6 L7HeFM8GzIMXqXXe0JLuzPF7qyXvj1wc3udUEIwUdgxz4sNvy9bHbuKbwhd02Y8OC124 k3nw== X-Gm-Message-State: AKS2vOx1mmCKmYDTfjcXiX2UUD3q4i2nnJ4omPEJ7/mrPNS1koARPClW eCVfOvtM0+6I/0e4 X-Received: by 10.28.12.1 with SMTP id 1mr7214244wmm.109.1497615570541; Fri, 16 Jun 2017 05:19:30 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id p199sm1251172wme.9.2017.06.16.05.19.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Jun 2017 05:19:29 -0700 (PDT) Date: Fri, 16 Jun 2017 14:19:22 +0200 From: Adrien Mazarguil To: Ferruh Yigit Cc: Nelio Laranjeiro , DPDK Message-ID: <20170616121922.GC1758@6wind.com> References: <2f049b66-c76a-9ff8-20c2-df2c25957f59@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f049b66-c76a-9ff8-20c2-df2c25957f59@intel.com> Subject: Re: [dpdk-dev] mlx debug build error with clang 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, 16 Jun 2017 12:19:31 -0000 Hi Ferruh, On Tue, Jun 13, 2017 at 04:32:03PM +0100, Ferruh Yigit wrote: > Hi Adrien, Nelio, > > I am getting following build error [1] with clang [2] when debug enabled > for mlx4 and mlx5. > > This started after I update my box, not sure what triggered this. > Can you please help fixing this? > > Thanks, > ferruh > > > [1] > > .../drivers/net/mlx4/mlx4_flow.c:731:3: error: use of GNU statement > expression extension [-Werror,-Wgnu-statement-expression] > claim_zero(ibv_destroy_qp(fdq->qp)); > ^ > .../drivers/net/mlx4/mlx4.h:185:25: note: expanded from macro 'claim_zero' > #define claim_zero(...) assert((__VA_ARGS__) == 0) > ^ > /usr/include/assert.h:95:6: note: expanded from macro 'assert' > ({ \ > ^ > > .... > > .../drivers/net/mlx5/mlx5_fdir.c:278:2: error: use of GNU statement > expression extension [-Werror,-Wgnu-statement-expression] > assert(((uint8_t *)attr + sizeof(*attr)) == (uint8_t *)spec_offset); > ^ > /usr/include/assert.h:95:6: note: expanded from macro 'assert' > ({ \ > ^ > > [Many of similar ...] > > > [2] > target: x86_64-native-linuxapp-clang > > clang version 4.0.0 (tags/RELEASE_400/final) Recent Glibc versions now apparently handle assert() through a nonstandard ({ }) construct, which is not pedantic-safe due to a missing __extension__ keyword. assert.h still provides a standard assert() definition that shouldn't cause compilation to fail when the following condition is met: #if !defined __GNUC__ || defined __STRICT_ANSI__ However __GNUC__ is (always?) defined by clang for maximum compatibility with GCC while __STRICT_ANSI__ is not due to the -std=gnu99 parameter, assert.h thinks it's OK to use a ({ }) construct but is then caught by clang's -pedantic parameter. There are two ways to address this issue while keeping our beloved -pedantic parameter in debug mode: 1. Replacing -std=gnu99 with -std=c99 (which is even stricter) to bring back __STRICT_ANSI__. 2. Replacing assert() statements with RTE_ASSERT(). The former should be doable now that DPDK includes have been cleaned up, and we're thinking about doing the latter at some point. Since I don't have a recent Glibc handy, can you try replacing -std=gnu99 with -std=c99 in both Makefiles (mlx4 and mlx5), and report how GCC and clang fare? (GCC at least seems to have no problem with that on my side) -- Adrien Mazarguil 6WIND