From: Flavia Musatescu <flavia.musatescu@intel.com>
To: stable@dpdk.org
Cc: kevin.laatz@intel.com, ktraynor@redhat.com,
Flavia Musatescu <flavia.musatescu@intel.com>,
Reshma Pattan <reshma.pattan@intel.com>
Subject: [dpdk-stable] [PATCH] Suppress the unaligned packed member address warnings by extending the telemetry library build flags with -Wno-address-of-packed-member option, through the WERROR_FLAGS makefile variable.
Date: Tue, 27 Aug 2019 16:52:31 +0100 [thread overview]
Message-ID: <1566921151-25798-1-git-send-email-flavia.musatescu@intel.com> (raw)
[ upstream commit 5c0bdc32034b2464305ee55b5829a45451f221ef ]
With this change additional warnings are turned on to be treated as errors,
which causes the following build issues to be seen:
- no previous prototype [-Werror=missing-prototypes]
- initialization discards ‘const’ qualifier from pointer target type
[-Werror=discarded-qualifiers]
- old-style function definition [-Werror=old-style-definition]
- variable may be used before its value is set (when using icc compiler).
Fixes: 0fe3a37924d4 ("telemetry: format json response when sending stats")
Fixes: ee5ff0d3297e ("telemetry: add client feature and sockets")
Fixes: 8877ac688b52 ("telemetry: introduce infrastructure")
Fixes: 1b756087db93 ("telemetry: add parser for client socket messages")
Fixes: fff6df7bf58e ("telemetry: fix using ports of different types")
Fixes: 4080e46c8078 ("telemetry: support global metrics")
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Signed-off-by: Flavia Musatescu <flavia.musatescu@intel.com>
---
lib/librte_eal/common/include/rte_option.h | 2 +-
lib/librte_telemetry/Makefile | 7 +----
lib/librte_telemetry/meson.build | 2 +-
lib/librte_telemetry/rte_telemetry.c | 19 ++++++------
lib/librte_telemetry/rte_telemetry_internal.h | 3 ++
lib/librte_telemetry/rte_telemetry_parser.c | 7 +++--
lib/librte_telemetry/rte_telemetry_parser_test.c | 27 ++++++++--------
lib/librte_telemetry/rte_telemetry_parser_test.h | 39 ------------------------
8 files changed, 33 insertions(+), 73 deletions(-)
delete mode 100644 lib/librte_telemetry/rte_telemetry_parser_test.h
diff --git a/lib/librte_eal/common/include/rte_option.h b/lib/librte_eal/common/include/rte_option.h
index 8957b97..b8ad28b 100644
--- a/lib/librte_eal/common/include/rte_option.h
+++ b/lib/librte_eal/common/include/rte_option.h
@@ -34,7 +34,7 @@ typedef int (*rte_option_cb)(void);
*/
struct rte_option {
TAILQ_ENTRY(rte_option) next; /**< Next entry in the list. */
- char *opt_str; /**< The option name. */
+ const char *opt_str; /**< The option name. */
rte_option_cb cb; /**< Function called when option is used. */
int enabled; /**< Set when the option is used. */
};
diff --git a/lib/librte_telemetry/Makefile b/lib/librte_telemetry/Makefile
index ef73a4e..1b3fe05 100644
--- a/lib/librte_telemetry/Makefile
+++ b/lib/librte_telemetry/Makefile
@@ -7,7 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
LIB = librte_telemetry.a
CFLAGS += -O3
-CFLAGS += -I$(SRCDIR)
+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
CFLAGS += -DALLOW_EXPERIMENTAL_API
LDLIBS += -lrte_eal -lrte_ethdev
@@ -19,11 +19,6 @@ EXPORT_MAP := rte_telemetry_version.map
LIBABIVER := 1
-ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-CFLAGS_rte_telemetry.o += -Wno-address-of-packed-member
-CFLAGS_rte_telemetry_parser.o += -Wno-address-of-packed-member
-endif
-
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_TELEMETRY) := rte_telemetry.c
SRCS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += rte_telemetry_parser.c
diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build
index 9492f54..83c48dc 100644
--- a/lib/librte_telemetry/meson.build
+++ b/lib/librte_telemetry/meson.build
@@ -2,7 +2,7 @@
# Copyright(c) 2018 Intel Corporation
sources = files('rte_telemetry.c', 'rte_telemetry_parser.c', 'rte_telemetry_parser_test.c')
-headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_parser.h', 'rte_telemetry_parser_test.h')
+headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_parser.h')
deps += ['metrics', 'ethdev']
cflags += '-DALLOW_EXPERIMENTAL_API'
diff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c
index 7fb247e..b07ac0a 100644
--- a/lib/librte_telemetry/rte_telemetry.c
+++ b/lib/librte_telemetry/rte_telemetry.c
@@ -18,7 +18,6 @@
#include "rte_telemetry.h"
#include "rte_telemetry_internal.h"
#include "rte_telemetry_parser.h"
-#include "rte_telemetry_parser_test.h"
#include "rte_telemetry_socket_tests.h"
#define BUF_SIZE 1024
@@ -32,13 +31,13 @@
static telemetry_impl *static_telemetry;
struct telemetry_message_test {
- char *test_name;
+ const char *test_name;
int (*test_func_ptr)(struct telemetry_impl *telemetry, int fd);
};
struct json_data {
char *status_code;
- char *data;
+ const char *data;
int port;
char *stat_name;
int stat_value;
@@ -137,7 +136,7 @@ rte_telemetry_update_metrics_ethdev(struct telemetry_impl *telemetry,
return 0;
}
-int32_t
+static int32_t
rte_telemetry_write_to_socket(struct telemetry_impl *telemetry,
const char *json_string)
{
@@ -661,7 +660,7 @@ rte_telemetry_initial_accept(struct telemetry_impl *telemetry)
struct driver_index {
const void *dev_ops;
int reg_index;
- } drv_idx[RTE_MAX_ETHPORTS];
+ } drv_idx[RTE_MAX_ETHPORTS] = { {0} };
int nb_drv_idx = 0;
uint16_t pid;
int ret;
@@ -911,7 +910,7 @@ rte_telemetry_create_socket(struct telemetry_impl *telemetry)
}
int32_t __rte_experimental
-rte_telemetry_init()
+rte_telemetry_init(void)
{
int ret;
pthread_attr_t attr;
@@ -1196,7 +1195,7 @@ rte_telemetry_parse_client_message(struct telemetry_impl *telemetry, char *buf)
return -1;
}
-int32_t
+static int32_t
rte_telemetry_dummy_client_socket(const char *valid_client_path)
{
int sockfd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
@@ -1671,8 +1670,8 @@ rte_telemetry_json_contents_test(struct telemetry_impl *telemetry, int fd)
int ret;
char buf[BUF_SIZE];
int fail_count = 0;
- char *status = "Status Error: Invalid Argument 404";
- char *data = "null";
+ const char *status = "Status Error: Invalid Argument 404";
+ const char *data = "null";
struct json_data *data_struct;
const char *invalid_contents = "{\"action\":0,\"command\":"
"\"ports_stats_values_by_name\",\"data\":{\"ports\""
@@ -1728,7 +1727,7 @@ rte_telemetry_json_empty_test(struct telemetry_impl *telemetry, int fd)
char buf[BUF_SIZE];
int fail_count = 0;
const char *status = "Status Error: Invalid Argument 404";
- char *data = "null";
+ const char *data = "null";
struct json_data *data_struct;
const char *empty_json = "{}";
int buffer_read = 0;
diff --git a/lib/librte_telemetry/rte_telemetry_internal.h b/lib/librte_telemetry/rte_telemetry_internal.h
index c298c39..39b2928 100644
--- a/lib/librte_telemetry/rte_telemetry_internal.h
+++ b/lib/librte_telemetry/rte_telemetry_internal.h
@@ -78,4 +78,7 @@ rte_telemetry_send_ports_stats_values(uint32_t *metric_ids, int num_metric_ids,
int32_t
rte_telemetry_socket_messaging_testing(int index, int socket);
+int32_t
+rte_telemetry_parser_test(struct telemetry_impl *telemetry);
+
#endif
diff --git a/lib/librte_telemetry/rte_telemetry_parser.c b/lib/librte_telemetry/rte_telemetry_parser.c
index e929702..07fe028 100644
--- a/lib/librte_telemetry/rte_telemetry_parser.c
+++ b/lib/librte_telemetry/rte_telemetry_parser.c
@@ -13,11 +13,12 @@
#include <rte_ethdev.h>
#include "rte_telemetry_internal.h"
+#include "rte_telemetry_parser.h"
typedef int (*command_func)(struct telemetry_impl *, int, json_t *);
struct rte_telemetry_command {
- char *text;
+ const char *text;
command_func fn;
} command;
@@ -251,7 +252,7 @@ rte_telemetry_stat_names_to_ids(struct telemetry_impl *telemetry,
return -1;
}
-int32_t
+static int32_t
rte_telemetry_command_ports_all_stat_values(struct telemetry_impl *telemetry,
int action, json_t *data)
{
@@ -350,7 +351,7 @@ rte_telemetry_command_ports_all_stat_values(struct telemetry_impl *telemetry,
return -1;
}
-int32_t
+static int32_t
rte_telemetry_command_ports_stats_values_by_name(struct telemetry_impl
*telemetry, int action, json_t *data)
{
diff --git a/lib/librte_telemetry/rte_telemetry_parser_test.c b/lib/librte_telemetry/rte_telemetry_parser_test.c
index 5fe93fa..23ec7a7 100644
--- a/lib/librte_telemetry/rte_telemetry_parser_test.c
+++ b/lib/librte_telemetry/rte_telemetry_parser_test.c
@@ -16,6 +16,7 @@
#include <rte_string_fns.h>
#include "rte_telemetry_parser.h"
+#include "rte_telemetry_internal.h"
enum choices {
INV_ACTION_VAL,
@@ -31,7 +32,7 @@ enum choices {
#define TEST_CLIENT "/var/run/dpdk/test_client"
-int32_t
+static int32_t
rte_telemetry_create_test_socket(struct telemetry_impl *telemetry,
const char *test_client_path)
{
@@ -82,7 +83,7 @@ rte_telemetry_create_test_socket(struct telemetry_impl *telemetry,
return 0;
}
-int32_t
+static int32_t
rte_telemetry_format_port_stat_ids(int *port_ids, int num_port_ids,
const char * const *stat_names, int num_stat_names, json_t **data)
{
@@ -165,8 +166,8 @@ rte_telemetry_format_port_stat_ids(int *port_ids, int num_port_ids,
return -1;
}
-int32_t
-rte_telemetry_create_json_request(int action, char *command,
+static int32_t
+rte_telemetry_create_json_request(int action, const char *command,
const char *client_path, int *port_ids, int num_port_ids,
const char * const *stat_names, int num_stat_names, char **request,
int inv_choice)
@@ -262,13 +263,13 @@ rte_telemetry_create_json_request(int action, char *command,
return -1;
}
-int32_t
+static int32_t
rte_telemetry_send_get_ports_and_stats_request(struct telemetry_impl *telemetry,
- int action_choice, char *command_choice, int inv_choice)
+ int action_choice, const char *command_choice, int inv_choice)
{
int ret;
char *request;
- char *client_path_data = NULL;
+ const char *client_path_data = NULL;
if (telemetry == NULL) {
TELEMETRY_LOG_ERR("Telemetry argument has not been initialised");
@@ -302,7 +303,7 @@ rte_telemetry_send_get_ports_and_stats_request(struct telemetry_impl *telemetry,
return 0;
}
-int32_t
+static int32_t
rte_telemetry_send_get_ports_details_request(struct telemetry_impl *telemetry,
int action_choice, int *port_ids, int num_port_ids, int inv_choice)
{
@@ -313,7 +314,7 @@ rte_telemetry_send_get_ports_details_request(struct telemetry_impl *telemetry,
return -EINVAL;
}
- char *command = "ports_details";
+ const char *command = "ports_details";
if (inv_choice == INV_ACTION_VAL)
action_choice = -1;
@@ -342,7 +343,7 @@ rte_telemetry_send_get_ports_details_request(struct telemetry_impl *telemetry,
return 0;
}
-int32_t
+static int32_t
rte_telemetry_send_stats_values_by_name_request(struct telemetry_impl
*telemetry, int action_choice, int *port_ids, int num_port_ids,
const char * const *stat_names, int num_stat_names,
@@ -350,7 +351,7 @@ rte_telemetry_send_stats_values_by_name_request(struct telemetry_impl
{
int ret;
char *request;
- char *command = "ports_stats_values_by_name";
+ const char *command = "ports_stats_values_by_name";
if (telemetry == NULL) {
TELEMETRY_LOG_ERR("Telemetry argument has not been initialised");
@@ -386,7 +387,7 @@ rte_telemetry_send_stats_values_by_name_request(struct telemetry_impl
return 0;
}
-int32_t
+static int32_t
rte_telemetry_send_unreg_request(struct telemetry_impl *telemetry,
int action_choice, const char *client_path, int inv_choice)
{
@@ -398,7 +399,7 @@ rte_telemetry_send_unreg_request(struct telemetry_impl *telemetry,
return -EINVAL;
}
- char *command = "clients";
+ const char *command = "clients";
if (inv_choice == INV_ACTION_VAL)
action_choice = -1;
diff --git a/lib/librte_telemetry/rte_telemetry_parser_test.h b/lib/librte_telemetry/rte_telemetry_parser_test.h
deleted file mode 100644
index 6ada852..0000000
--- a/lib/librte_telemetry/rte_telemetry_parser_test.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef _RTE_TELEMETRY_PARSER_TEST_H_
-#define _RTE_TELEMETRY_PARSER_TEST_H_
-
-int32_t
-rte_telemetry_parser_test(struct telemetry_impl *telemetry);
-
-int32_t
-rte_telemetry_format_port_stat_ids(int *port_ids, int num_port_ids,
- const char * const stat_names, int num_stat_names, json_t **data);
-
-int32_t
-rte_telemetry_create_json_request(int action, char *command,
- const char *client_path, int *port_ids, int num_port_ids,
- const char * const stat_names, int num_stat_names, char **request,
- int inv_choice);
-
-int32_t
-rte_telemetry_send_get_ports_and_stats_request(struct telemetry_impl *telemetry,
- int action_choice, char *command_choice, int inv_choice);
-
-int32_t
-rte_telemetry_send_get_ports_details_request(struct telemetry_impl *telemetry,
- int action_choice, int *port_ids, int num_port_ids, int inv_choice);
-
-int32_t
-rte_telemetry_send_stats_values_by_name_request(struct telemetry_impl
- *telemetry, int action_choice, int *port_ids, int num_port_ids,
- const char * const stat_names, int num_stat_names,
- int inv_choice);
-
-int32_t
-rte_telemetry_send_unreg_request(int action_choice, const char *client_path,
- int inv_choice);
-
-#endif
--
2.7.4
next reply other threads:[~2019-08-27 15:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 15:52 Flavia Musatescu [this message]
2019-08-28 9:46 ` [dpdk-stable] [PATCH v2] telemetry: fix build warnings seen when using gcc 9 Flavia Musatescu
2019-09-06 15:11 ` [dpdk-stable] [PATCH 18.11 v3] " Flavia Musatescu
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=1566921151-25798-1-git-send-email-flavia.musatescu@intel.com \
--to=flavia.musatescu@intel.com \
--cc=kevin.laatz@intel.com \
--cc=ktraynor@redhat.com \
--cc=reshma.pattan@intel.com \
--cc=stable@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).