From: "Wiles, Keith" <keith.wiles@intel.com>
To: Adam Drescher <adam.r.drescher@gmail.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] pktgen: fix clang compiler errors / warnings
Date: Tue, 18 Jun 2019 21:18:30 +0000 [thread overview]
Message-ID: <81AA3BDC-5BF8-43E2-B383-4E8497054771@intel.com> (raw)
In-Reply-To: <20190618205800.27441-1-adam.r.drescher@gmail.com>
> On Jun 18, 2019, at 3:58 PM, Adam Drescher <adam.r.drescher@gmail.com> wrote:
>
> 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.
Thanks, I will review the patch and commit or reply with comments.
>
> Signed-off-by: Adam Drescher <adam.r.drescher@gmail.com>
> ---
> 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 <stdint.h>
> #include <netinet/in.h>
> 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);
> --
> 2.20.1
>
Regards,
Keith
prev parent reply other threads:[~2019-06-18 21:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 20:58 Adam Drescher
2019-06-18 21:18 ` Wiles, Keith [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81AA3BDC-5BF8-43E2-B383-4E8497054771@intel.com \
--to=keith.wiles@intel.com \
--cc=adam.r.drescher@gmail.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).