From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id C876CDE0 for ; Tue, 14 Feb 2017 15:36:18 +0100 (CET) Received: by mail-wr0-f195.google.com with SMTP id o16so27890279wra.2 for ; Tue, 14 Feb 2017 06:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=gDokYGrRg8z6UHp/qMXi+e3Md2nxRvnRJEly26fgRRQ=; b=sRkgKgmPwPXQTm1soIeIJOpP2e263iKdS5qlY3rypNdoqghW+TTrlUDRnryeSO/eoV Mp8y5+v0rBGoHpyLDJFcmmN4CJ+73Q1HvBGhCZxUI72ETRqRIoZ85YuK685KFkroI0er TswftqB75DQw8GdRN76nVkktMCZ5JIv9rD7jVYQWtWKMHk0i1wUwneELPqmTSGZ9+JDt SXslUAVBhuTUhGYXlPjprQdaZISurzxMYg2Di3yVLf3S+GYhNzOIuNja+KcCm4DQX2rh f0YA4uutjRGh81szi7W+zp9zfJF98eRRIR8IxFE5d9jl0lqGOJtzeVFxdD4HJX01t7bz Onag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=gDokYGrRg8z6UHp/qMXi+e3Md2nxRvnRJEly26fgRRQ=; b=lv33HbM9AzIQYRZjf98pn6UOEgED/9cB83f+WHBnn2+gdKAHEJdCGqHh+ds3dl/8dh bRx234/Cu/Y5TVP0C6VU4kfd3p8ikkWOiMvQyj0L9UtP5UE7XVPGpBAHT2aol3YseRRn ziAD83Z6qSzkbiNQ3egNIwgUjSYwkw99lYvd0ZUtH7ZMQg6TfsqH4SD6mkmIRYnaPBkr t++AvFRd4yrHmMCgNX5cxC+OfS0yad+qGELCI6WSEqsYueGdDSXiBCdnV1yTZAEnrtQy JW6hSZh7LVPcVZGH5w+63mhXqauRAzJkRTJzN+ahT/steJo8sneTl5QGkmRfMBtsAZBw 21eQ== X-Gm-Message-State: AMke39mRosrmBVo2/MaBAziViz8pQU6rur4dgbRpnytdgqqgxyskSSyzo9fY1uSLabCRMg== X-Received: by 10.223.155.221 with SMTP id e29mr25913215wrc.107.1487082978427; Tue, 14 Feb 2017 06:36:18 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id z134sm3718236wmc.20.2017.02.14.06.36.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Feb 2017 06:36:17 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Date: Tue, 14 Feb 2017 15:36:06 +0100 Message-Id: <1487082966-21074-2-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487082966-21074-1-git-send-email-jblunck@infradead.org> References: <1487082966-21074-1-git-send-email-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH 2/2] Ensure constness of target pointer type 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: Tue, 14 Feb 2017 14:36:19 -0000 This adds a check to ensure that the container_of() macro is not used to cast away (remove) constness. Signed-off-by: Jan Blunck --- lib/librte_eal/common/include/rte_common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index c421708..e057f6e 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -348,6 +348,8 @@ rte_bsf32(uint32_t v) #ifndef container_of #define container_of(ptr, type, member) __extension__ ({ \ const typeof(((type *)0)->member) *_ptr = (ptr); \ + __attribute__((unused)) type *_target_ptr = \ + (type *)(ptr); \ (type *)(((uintptr_t)_ptr) - offsetof(type, member)); \ }) #endif -- 2.7.4