From patchwork Tue Jun 18 20:58:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Drescher X-Patchwork-Id: 54931 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 911521C25F; Tue, 18 Jun 2019 22:58:36 +0200 (CEST) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by dpdk.org (Postfix) with ESMTP id 323A41C25C for ; Tue, 18 Jun 2019 22:58:34 +0200 (CEST) Received: by mail-qk1-f195.google.com with SMTP id d15so9534736qkl.4 for ; Tue, 18 Jun 2019 13:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bhl9SxZ0d2PKOCES0dqv06E8VHuaCwWKEB1x8UYvvU8=; b=ElpTCs6OwBO2hsxPnPN0lObXLU4ukzJ+jGxNkyQjO2A/cVAhRywQOCrtyZi4gRd/Pq koXW30wvktEbNU8zyyZju8++lDqfKipiTY80IA//t9oFWxYeiaCg9bUtpR6auOV8YCjU SvVuXyfg3cN0KvgYNn9FXrd7PIGCkVaI1pkC91+/zzRYxkY86KKvKk3sTGJ6aqsGcgKz GU3av+bWpzwGQ6yez9RG2pc+g4xhGI6F/GA5shCS3PmoGqcuyzjChAce4GQkFZaaJE8b nu3hIFtQm/X9E5yy6IQR0bNxJ8apM0/LE5+7TvgHG5c7o5NJrWDtwHMktK+OXabG+yWV 9gKA== 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:mime-version :content-transfer-encoding; bh=bhl9SxZ0d2PKOCES0dqv06E8VHuaCwWKEB1x8UYvvU8=; b=HA0X5QOTjsxS4WU9DM3QYfDXQClgkMSilxsjoF+fabaazg/iJdMdmGdWcvpjsL436Z tzcmlaSY6ocu2PaJhX13iuWODz5pwBflxhs5E9s9Ace5AWH8C85m9FoNLQPosZ+ouLY8 07+v/XrjKHchc1l1bb8Y47ZER/h1zvYxeDC/6ogkNNDnnNqViitoGYEFmM/CrBsBZj5I ZE6a/9pwhRz36VpQlMVsg9TpBcwFA/Du+5JCkTEmFAqNJ76UB9GU6e2FxwLFnbxjbCpZ 1E0AC9Omwa951IhfGJaE/cDA5zUxCQW6tsKuBWEkw+ZPQB0Dt7bLvS+hFEyafslSBhWe ID4g== X-Gm-Message-State: APjAAAVS7tRNOFWmDHkKtMLuqVgclNjKAfNu7l66OPzD7T2LmyRI+Ss/ l46UW1bRjV4EILvf7lDUHw== X-Google-Smtp-Source: APXvYqyZJfr1riRG96PYFfMndK0Zlr57gpfoLlf7yrBkg6VazDHZukszDkUzhkTaLM8tPyF8wEtksw== X-Received: by 2002:a37:d8e:: with SMTP id 136mr82685559qkn.259.1560891513457; Tue, 18 Jun 2019 13:58:33 -0700 (PDT) Received: from cpp-rtp-gca-06.cisco.com ([2001:420:27c1:b05:225:b5ff:fe00:81d]) by smtp.googlemail.com with ESMTPSA id h185sm9734516qkd.11.2019.06.18.13.58.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 18 Jun 2019 13:58:32 -0700 (PDT) From: Adam Drescher To: keith.wiles@intel.com Cc: dev@dpdk.org, Adam Drescher Date: Tue, 18 Jun 2019 20:58:00 +0000 Message-Id: <20190618205800.27441-1-adam.r.drescher@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] pktgen: fix clang compiler errors / warnings 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Clang complains about the following issues: (1) unclear meaning of =- in assignment of pktgen.verbose (2) unused function sct(), which is also defined in cli_cmds.c (3) typo in include guard for rte_lua_vec.h (4) duplicate inline due to expansion of __rte_always_inline Tested the patch on both clang and gcc. Not sure how strong pktgen's backwards compatability guarantees are, but __rte_always_inline is good back to DPDK v18.02 at least. Signed-off-by: Adam Drescher --- app/pktgen-main.c | 2 +- lib/cli/cli_cmap.c | 23 ----------------------- lib/lua/rte_lua_vec.h | 2 +- lib/vec/rte_vec.h | 32 ++++++++++++++++---------------- 4 files changed, 18 insertions(+), 41 deletions(-) diff --git a/app/pktgen-main.c b/app/pktgen-main.c index 6b9d90e..e87e2f5 100644 --- a/app/pktgen-main.c +++ b/app/pktgen-main.c @@ -252,7 +252,7 @@ pktgen_parse_args(int argc, char **argv) pktgen.flags |= ENABLE_THEME_FLAG; break; case 'v': - pktgen.verbose =- 1; + pktgen.verbose = 1; break; case 'h': /* print out the help message */ diff --git a/lib/cli/cli_cmap.c b/lib/cli/cli_cmap.c index 66638b7..1c932d6 100644 --- a/lib/cli/cli_cmap.c +++ b/lib/cli/cli_cmap.c @@ -285,26 +285,3 @@ cmap_free(struct cmap *cmap) { free(cmap); } - -/* Helper for building log strings. - * The macro takes an existing string, a printf-like format string and optional - * arguments. It formats the string and appends it to the existing string, - * while avoiding possible buffer overruns. - */ -#define strncatf(dest, fmt, ...) do { \ - char _buff[1024]; \ - snprintf(_buff, sizeof(_buff), fmt, ## __VA_ARGS__); \ - strncat(dest, _buff, sizeof(dest) - strlen(dest) - 1); \ -} while (0) - -static __inline__ uint8_t -sct(struct cmap *cm, uint8_t s, uint8_t c, uint8_t t) { - lc_info_t *lc = cm->linfo; - uint8_t i; - - for (i = 0; i < cm->num_cores; i++, lc++) - if (lc->sid == s && lc->cid == c && lc->tid == t) - return lc->lid; - - return 0; -} diff --git a/lib/lua/rte_lua_vec.h b/lib/lua/rte_lua_vec.h index b329f1a..8eaf83c 100644 --- a/lib/lua/rte_lua_vec.h +++ b/lib/lua/rte_lua_vec.h @@ -4,7 +4,7 @@ /* Created 2018 by Keith Wiles @ intel.com */ #ifndef _RTE_LUA_VEC_H_ -#define _RTE_LUAVEC_H_ +#define _RTE_LUA_VEC_H_ #include #include diff --git a/lib/vec/rte_vec.h b/lib/vec/rte_vec.h index b465525..77dc706 100644 --- a/lib/vec/rte_vec.h +++ b/lib/vec/rte_vec.h @@ -99,49 +99,49 @@ rte_vec_clr_dont_free(struct rte_vec *vec) vec->flags &= ~VEC_DONT_FREE_FLAG; } -static inline __rte_always_inline uint16_t +static __rte_always_inline uint16_t rte_vec_len(struct rte_vec *v) { return v->len; } -static inline __rte_always_inline int +static __rte_always_inline int rte_vec_byte_len(struct rte_vec *v) { return v->len * sizeof(void *); } -static inline __rte_always_inline void +static __rte_always_inline void rte_vec_set_len(struct rte_vec *v, uint16_t n) { v->len = n; } -static inline __rte_always_inline void +static __rte_always_inline void rte_vec_set_max_len(struct rte_vec *v, uint16_t n) { v->tlen = n; } -static inline __rte_always_inline void +static __rte_always_inline void rte_vec_dec_len(struct rte_vec *v) { v->len--; } -static inline __rte_always_inline void +static __rte_always_inline void rte_vec_inc_len(struct rte_vec *v) { v->len++; } -static inline __rte_always_inline uint16_t +static __rte_always_inline uint16_t rte_vec_max_len(struct rte_vec *v) { return v->tlen; } -static inline __rte_always_inline struct rte_mbuf ** +static __rte_always_inline struct rte_mbuf ** rte_vec_list(struct rte_vec *v) { return (struct rte_mbuf * *)&v->list[0]; @@ -151,7 +151,7 @@ rte_vec_list(struct rte_vec *v) #pragma GCC diagnostic ignored "-Warray-bounds" /* return -1 on full and index value if OK */ -static inline __rte_always_inline int +static __rte_always_inline int rte_vec_add1(struct rte_vec *vec, void *val) { if (vec->len >= vec->tlen) @@ -161,7 +161,7 @@ rte_vec_add1(struct rte_vec *vec, void *val) return vec->len - 1; } -static inline __rte_always_inline int +static __rte_always_inline int rte_vec_add_at_index(struct rte_vec *vec, void *val, uint16_t n) { if (vec->len >= vec->tlen) @@ -171,7 +171,7 @@ rte_vec_add_at_index(struct rte_vec *vec, void *val, uint16_t n) return 0; } -static inline __rte_always_inline void * +static __rte_always_inline void * rte_vec_at_index(struct rte_vec *vec, uint16_t n) { if (n >= vec->len) @@ -179,32 +179,32 @@ rte_vec_at_index(struct rte_vec *vec, uint16_t n) return vec->list[n]; } -static inline __rte_always_inline void +static __rte_always_inline void rte_vec_set_at_index(struct rte_vec *vec, uint16_t idx, void *val) { if (idx < vec->tlen) vec->list[idx] = val; } -static inline __rte_always_inline struct rte_mbuf ** +static __rte_always_inline struct rte_mbuf ** rte_vec_addr(struct rte_vec *vec, uint16_t n) { return (struct rte_mbuf * *)&vec->list[n]; } -static inline __rte_always_inline struct rte_mbuf ** +static __rte_always_inline struct rte_mbuf ** rte_vec_end(struct rte_vec *vec) { return (struct rte_mbuf * *)&vec->list[vec->len]; } -static inline __rte_always_inline int +static __rte_always_inline int rte_vec_len_remaining(struct rte_vec *vec) { return vec->tlen - vec->len; } -static inline __rte_always_inline int +static __rte_always_inline int rte_vec_is_full(struct rte_vec *v) { return (v->len == v->tlen);