From patchwork Mon Apr 24 13:31:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Alemayhu X-Patchwork-Id: 754265 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wBS1B1vlJz9s8Y for ; Mon, 24 Apr 2017 23:31:42 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=alemayhu-com.20150623.gappssmtp.com header.i=@alemayhu-com.20150623.gappssmtp.com header.b="fQED8lLw"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1171409AbdDXNbk (ORCPT ); Mon, 24 Apr 2017 09:31:40 -0400 Received: from mail-lf0-f54.google.com ([209.85.215.54]:33782 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1171341AbdDXNbc (ORCPT ); Mon, 24 Apr 2017 09:31:32 -0400 Received: by mail-lf0-f54.google.com with SMTP id 88so73891872lfr.0 for ; Mon, 24 Apr 2017 06:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alemayhu-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CWbmWgZ3BSSjFKTPh8nrwFbn5dn1po4by3auc7QK6og=; b=fQED8lLw7Tw0LTe5VvMCLSqeQImQzf9FFYAfnNCE+WHTHoezshqOejXYzBHOUqpZ5Z jLCtxo6gCMpkF6noFJKRWl3sDweBKCci1fgR9Yx2Y5bfbaHgSVth607jdfTPnO1fr18t 2b+I51oEbNmMDdSmAf2MVjH7AUnTXttYNE45rt0WLi2gGZROIl26+Lo2FKbUI211kVEg yuAR5zOIT2V0K5a1nqca104Ik7IOcAsITcVDmYEDnPq8v5QDiY6vxht14LzVflVpZih1 20Rhyc5LAvCuW3zW26d7gSOSJ+oN7NndXwd+ft7JCPrqqsz5t5RRem0E6lVBR2MGDTp/ L1mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CWbmWgZ3BSSjFKTPh8nrwFbn5dn1po4by3auc7QK6og=; b=ZBOHr/loXg6RSlJIE30sPmlolGN91O2gqnEfZoHctbDQhvGAlLX8Rzdz/8jzDIYqCc XqgNc9rjCjm1E1x/kcZ6Ddjbh1RNWpS7X0U2HjNdDML2oucc/k2soIhqY3TC+5obyHBf zCHXu+rL4+cu/a0vDdkLsy9TZEu6tI7oppmsACqmvwgYbqhBO22dDmi2/PmP2KBwpTlA DjPJ3qM3RsA5iKSLmjE0G6zymCWuueJ5BLCyhigOWLrqBqWlOyTlo+3c91PoArlxyU0C jjr28OCMxmas0mbrEOpcdO8aBNyspubvjwy/eYxa5EKFcHx2tn9Dcs9Hict0igX6D36G mtNA== X-Gm-Message-State: AN3rC/7X8Z8KPwmZi5m4C+E0pc6TZqf6QPq0C4VGLvWU+G/8Hk6wxMkN XFSp2AyyNeMORg== X-Received: by 10.46.9.208 with SMTP id 199mr9886132ljj.42.1493040680863; Mon, 24 Apr 2017 06:31:20 -0700 (PDT) Received: from localhost ([2a02:fe0:c020:790::6]) by smtp.gmail.com with ESMTPSA id g24sm3390806ljg.11.2017.04.24.06.31.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Apr 2017 06:31:20 -0700 (PDT) From: Alexander Alemayhu To: netdev@vger.kernel.org Cc: Alexander Alemayhu , daniel@iogearbox.net, ast@fb.com Subject: [PATCH net-next 3/3] samples/bpf: check before defining offsetof Date: Mon, 24 Apr 2017 15:31:08 +0200 Message-Id: <20170424133108.31595-4-alexander@alemayhu.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170424133108.31595-1-alexander@alemayhu.com> References: <20170424133108.31595-1-alexander@alemayhu.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Fixes the following warning samples/bpf/test_lru_dist.c:28:0: warning: "offsetof" redefined #define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER) In file included from ./tools/lib/bpf/bpf.h:25:0, from samples/bpf/libbpf.h:5, from samples/bpf/test_lru_dist.c:24: /usr/lib/gcc/x86_64-redhat-linux/6.3.1/include/stddef.h:417:0: note: this is the location of the previous definition #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) Signed-off-by: Alexander Alemayhu Acked-by: Daniel Borkmann --- samples/bpf/test_lru_dist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/samples/bpf/test_lru_dist.c b/samples/bpf/test_lru_dist.c index d96dc88d3b04..73c357142268 100644 --- a/samples/bpf/test_lru_dist.c +++ b/samples/bpf/test_lru_dist.c @@ -25,7 +25,9 @@ #include "bpf_util.h" #define min(a, b) ((a) < (b) ? (a) : (b)) -#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER) +#ifndef offsetof +# define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER) +#endif #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );})