From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BA948A04C5; Fri, 4 Sep 2020 22:47:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0186C1BC25; Fri, 4 Sep 2020 22:47:44 +0200 (CEST) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by dpdk.org (Postfix) with ESMTP id 938D2DE0; Fri, 4 Sep 2020 22:47:42 +0200 (CEST) Received: by mail-lj1-f195.google.com with SMTP id w14so9521745ljj.4; Fri, 04 Sep 2020 13:47:42 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=jlZMjljjq3FEmdlD0yxnYvS4q6+mQfI3bdiFPpxD+m0=; b=UNUj1MOpuX+2irxT6N5lEM0dv+zXYaE4e1QQQHp+1kHWFOhXFUGriWkIUdB3Xpx8C8 NwmUnB2O4kCb6dv0X2Pw25IFI7LaYcMMNU6aZjIWv/oKUsz9tTgqvTzLUHeOxhkA1zWP hWSNwWL7P7QOFGYk/D9JfQxUPt1kCUlbRbp+TFUW/tANfnRPO2B/4677/33sQK2odgHE +oFnMntGUA0wGF8MZBgY1hD/+L1qkrV9luTsNQe/v9J+1A3YLhfskMxhiMWtHhoRUc8B hANe43uDo+T88RxUim8ytrBHGgETtVkdAcqsyVw1y46+46kvG77iuOT3/4GJr/urvaMi iPGA== 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:mime-version:content-transfer-encoding; bh=jlZMjljjq3FEmdlD0yxnYvS4q6+mQfI3bdiFPpxD+m0=; b=YS6MUzLjb59yUUgAVwSOWysL9e/2+jwvKE2qbe0BEQh8onoaA7vUY0p0oJbg6rBYLP tX0TgdoYdR88UiNYsUBSn5kjIeFpo5/zl6SxbE7ZsgdewBoOQSB/YJYb6+Sz4d9WNJ93 GQungVDn8ffuLJGtqv++sZfvXXt+tz4Ttyj6qpCnnnEr2Z5XMP+aIe7XNFdhw31SA7WW pcm0tWDzM/sKhNne3oFRJEeLUbOLUOU8BJXrLHRr7YobNERtzY4jJittAj1cZuzHY06+ 98wz+JIrfdy/OgOe2U6/MFbOP6Ch/tizuB8us2KEqCjYvYD/rMjE7QNFTC2p/b3FmkS4 g5Hg== X-Gm-Message-State: AOAM533ZtwUrbCITXyhMf3fnU931Wj0iBmGvp1f2+r3mb+hMEIV2dBJi xDqglfoz+l+sdI/nta/hbREjEyyzLV4b6Q== X-Google-Smtp-Source: ABdhPJyeh8WWry3cv11/8A42LJA17Me5pl7cd6Dqn7UcFJw1SQDy6k2Od8isgJ646UyIApclmZTuuw== X-Received: by 2002:a2e:9042:: with SMTP id n2mr4464990ljg.112.1599252461633; Fri, 04 Sep 2020 13:47:41 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id a2sm1453077ljp.26.2020.09.04.13.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 13:47:40 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , stable@dpdk.org, Honnappa Nagarahalli Date: Fri, 4 Sep 2020 23:47:34 +0300 Message-Id: <20200904204734.17042-1-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200831213811.21521-1-dmitry.kozliuk@gmail.com> References: <20200831213811.21521-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] lib/rcu: avoid literal suffix warning in C++ mode 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" Sequences like "value = %"PRIu64 (no space before PRIu64) are parsed as a single preprocessor token, user-defined-string-literal, in C++11 onwards. While modern compilers are smart enough to parse this properly, GCC 9.3.0 generates warnings like: rte_rcu_qsbr.h:555:26: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] Add spaces around format specifier macros to make public headers compatible with C++ without causing warnings. Make similar changes in C source for style consistency within the library. Fixes: 64994b56c ("rcu: add RCU library supporting QSBR mechanism") Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk --- v2: fix subject line, adjust C source for style consistency. lib/librte_rcu/rte_rcu_qsbr.c | 13 +++++++------ lib/librte_rcu/rte_rcu_qsbr.h | 14 +++++++------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/librte_rcu/rte_rcu_qsbr.c b/lib/librte_rcu/rte_rcu_qsbr.c index aebfdb0da..a5f9de326 100644 --- a/lib/librte_rcu/rte_rcu_qsbr.c +++ b/lib/librte_rcu/rte_rcu_qsbr.c @@ -244,10 +244,10 @@ rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v) fprintf(f, "\n"); - fprintf(f, " Token = %"PRIu64"\n", + fprintf(f, " Token = %" PRIu64 "\n", __atomic_load_n(&v->token, __ATOMIC_ACQUIRE)); - fprintf(f, " Least Acknowledged Token = %"PRIu64"\n", + fprintf(f, " Least Acknowledged Token = %" PRIu64 "\n", __atomic_load_n(&v->acked_token, __ATOMIC_ACQUIRE)); fprintf(f, "Quiescent State Counts for readers:\n"); @@ -257,7 +257,7 @@ rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v) id = i << __RTE_QSBR_THRID_INDEX_SHIFT; while (bmap) { t = __builtin_ctzl(bmap); - fprintf(f, "thread ID = %u, count = %"PRIu64", lock count = %u\n", + fprintf(f, "thread ID = %u, count = %" PRIu64 ", lock count = %u\n", id + t, __atomic_load_n( &v->qsbr_cnt[id + t].cnt, @@ -402,7 +402,7 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e) * other issues. */ rte_log(RTE_LOG_INFO, rte_rcu_log_type, - "%s(): Skipped enqueuing token = %"PRIu64"\n", + "%s(): Skipped enqueuing token = %" PRIu64 "\n", __func__, dq_elem->token); rte_errno = ENOSPC; @@ -410,7 +410,8 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e) } rte_log(RTE_LOG_INFO, rte_rcu_log_type, - "%s(): Enqueued token = %"PRIu64"\n", __func__, dq_elem->token); + "%s(): Enqueued token = %" PRIu64 "\n", + __func__, dq_elem->token); return 0; } @@ -449,7 +450,7 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, unsigned int n, rte_ring_dequeue_elem_finish(dq->r, 1); rte_log(RTE_LOG_INFO, rte_rcu_log_type, - "%s(): Reclaimed token = %"PRIu64"\n", + "%s(): Reclaimed token = %" PRIu64 "\n", __func__, dq_elem->token); dq->free_fn(dq->p, dq_elem->elem, 1); diff --git a/lib/librte_rcu/rte_rcu_qsbr.h b/lib/librte_rcu/rte_rcu_qsbr.h index a98e8f0f8..aa237cf75 100644 --- a/lib/librte_rcu/rte_rcu_qsbr.h +++ b/lib/librte_rcu/rte_rcu_qsbr.h @@ -552,7 +552,7 @@ rte_rcu_qsbr_quiescent(struct rte_rcu_qsbr *v, unsigned int thread_id) __atomic_store_n(&v->qsbr_cnt[thread_id].cnt, t, __ATOMIC_RELEASE); - __RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %"PRIu64", Thread ID = %d", + __RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %" PRIu64 ", Thread ID = %d", __func__, t, thread_id); } @@ -580,13 +580,13 @@ __rte_rcu_qsbr_check_selective(struct rte_rcu_qsbr *v, uint64_t t, bool wait) while (bmap) { j = __builtin_ctzl(bmap); __RTE_RCU_DP_LOG(DEBUG, - "%s: check: token = %"PRIu64", wait = %d, Bit Map = 0x%"PRIx64", Thread ID = %d", + "%s: check: token = %" PRIu64 ", wait = %d, Bit Map = 0x%" PRIx64 ", Thread ID = %d", __func__, t, wait, bmap, id + j); c = __atomic_load_n( &v->qsbr_cnt[id + j].cnt, __ATOMIC_ACQUIRE); __RTE_RCU_DP_LOG(DEBUG, - "%s: status: token = %"PRIu64", wait = %d, Thread QS cnt = %"PRIu64", Thread ID = %d", + "%s: status: token = %" PRIu64 ", wait = %d, Thread QS cnt = %" PRIu64 ", Thread ID = %d", __func__, t, wait, c, id+j); /* Counter is not checked for wrap-around condition @@ -643,12 +643,12 @@ __rte_rcu_qsbr_check_all(struct rte_rcu_qsbr *v, uint64_t t, bool wait) for (i = 0, cnt = v->qsbr_cnt; i < v->max_threads; i++, cnt++) { __RTE_RCU_DP_LOG(DEBUG, - "%s: check: token = %"PRIu64", wait = %d, Thread ID = %d", + "%s: check: token = %" PRIu64 ", wait = %d, Thread ID = %d", __func__, t, wait, i); while (1) { c = __atomic_load_n(&cnt->cnt, __ATOMIC_ACQUIRE); __RTE_RCU_DP_LOG(DEBUG, - "%s: status: token = %"PRIu64", wait = %d, Thread QS cnt = %"PRIu64", Thread ID = %d", + "%s: status: token = %" PRIu64 ", wait = %d, Thread QS cnt = %" PRIu64 ", Thread ID = %d", __func__, t, wait, c, i); /* Counter is not checked for wrap-around condition @@ -725,10 +725,10 @@ rte_rcu_qsbr_check(struct rte_rcu_qsbr *v, uint64_t t, bool wait) /* Check if all the readers have already acknowledged this token */ if (likely(t <= v->acked_token)) { __RTE_RCU_DP_LOG(DEBUG, - "%s: check: token = %"PRIu64", wait = %d", + "%s: check: token = %" PRIu64 ", wait = %d", __func__, t, wait); __RTE_RCU_DP_LOG(DEBUG, - "%s: status: least acked token = %"PRIu64"", + "%s: status: least acked token = %" PRIu64, __func__, v->acked_token); return 1; } -- 2.25.4