DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pallavi Kadam <pallavi.kadam@intel.com>
To: dev@dpdk.org, thomas@monjalon.net
Cc: ranjit.menon@intel.com, dmitry.kozliuk@gmail.com,
	Narcisa.Vasile@microsoft.com, tbashar@mellanox.com,
	Harini.Ramakrishnan@microsoft.com, talshn@mellanox.com,
	fady@mellanox.com, pallavi.kadam@intel.com
Subject: [dpdk-dev] [PATCH v4] eal: fix warnings on Windows
Date: Thu, 11 Jun 2020 12:50:55 -0700
Message-ID: <20200611195055.3024-1-pallavi.kadam@intel.com> (raw)
In-Reply-To: <20200528231455.13636-1-pallavi.kadam@intel.com>

Fixed bunch of warnings when compiling using clang on Windows
such as the use of an unsafe string function (strerror),
[-Wunused-variable], [-Wunused-function] in eal_common_options.c
[-Wunused-const-variable] in getopt.c and [-Wunused-parameter]
in eal_common_thread.c.
Also fixed warnings generated using Mingw:
[-Werror=old-style-definition], [-Werror=cast-function-type] and
[-Werror=attributes]

v4 changes:
	Removed -Werror that was added on Windows in v3
	Removed self 'Tested-by' line

v3 changes:
	Fixed pthread warning
	Added -Werror on Windows
	Fixed MinGW warnings

v2 changes:
	Excluded dirent.h file on Windows temporarily.
	(This file will stay on Windows for later use)

Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
---
 lib/librte_eal/common/eal_common_options.c | 8 +++++++-
 lib/librte_eal/windows/eal.c               | 2 +-
 lib/librte_eal/windows/eal_lcore.c         | 2 +-
 lib/librte_eal/windows/eal_thread.c        | 3 ++-
 lib/librte_eal/windows/getopt.c            | 4 ++--
 lib/librte_eal/windows/include/pthread.h   | 6 ++++--
 6 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 8f2cbd1c6..0546beb3a 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -18,7 +18,9 @@
 #endif
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef RTE_EXEC_ENV_WINDOWS
 #include <dirent.h>
+#endif
 
 #include <rte_string_fns.h>
 #include <rte_eal.h>
@@ -115,8 +117,10 @@ struct shared_driver {
 static struct shared_driver_list solib_list =
 TAILQ_HEAD_INITIALIZER(solib_list);
 
+#ifndef RTE_EXEC_ENV_WINDOWS
 /* Default path of external loadable drivers */
 static const char *default_solib_dir = RTE_EAL_PMD_PATH;
+#endif
 
 /*
  * Stringified version of solib path used by dpdk-pmdinfo.py
@@ -329,6 +333,7 @@ eal_plugin_add(const char *path)
 	return 0;
 }
 
+#ifndef RTE_EXEC_ENV_WINDOWS
 static int
 eal_plugindir_init(const char *path)
 {
@@ -362,6 +367,7 @@ eal_plugindir_init(const char *path)
 	/* XXX this ignores failures from readdir() itself */
 	return (dent == NULL) ? 0 : -1;
 }
+#endif
 
 int
 eal_plugins_init(void)
@@ -394,8 +400,8 @@ eal_plugins_init(void)
 		}
 
 	}
-	return 0;
 #endif
+	return 0;
 }
 
 /*
diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c
index d084606a6..a34e519ea 100644
--- a/lib/librte_eal/windows/eal.c
+++ b/lib/librte_eal/windows/eal.c
@@ -139,7 +139,7 @@ eal_log_level_parse(int argc, char **argv)
 }
 
 /* Parse the argument given in the command line of the application */
-__attribute__((optnone)) static int
+static int
 eal_parse_args(int argc, char **argv)
 {
 	int opt, ret;
diff --git a/lib/librte_eal/windows/eal_lcore.c b/lib/librte_eal/windows/eal_lcore.c
index 82ee45413..b36f0a83b 100644
--- a/lib/librte_eal/windows/eal_lcore.c
+++ b/lib/librte_eal/windows/eal_lcore.c
@@ -27,7 +27,7 @@ static struct _wcpu_map {
  * Create a map of all processors and associated cores on the system
  */
 void
-eal_create_cpu_map()
+eal_create_cpu_map(void)
 {
 	wcpu_map.total_procs =
 		GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
diff --git a/lib/librte_eal/windows/eal_thread.c b/lib/librte_eal/windows/eal_thread.c
index 4c1e31c58..3dd56519c 100644
--- a/lib/librte_eal/windows/eal_thread.c
+++ b/lib/librte_eal/windows/eal_thread.c
@@ -140,7 +140,8 @@ eal_thread_create(pthread_t *thread)
 {
 	HANDLE th;
 
-	th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
+	th = CreateThread(NULL, 0,
+		(LPTHREAD_START_ROUTINE)(ULONG_PTR)eal_thread_loop,
 						NULL, 0, (LPDWORD)thread);
 	if (!th)
 		return -1;
diff --git a/lib/librte_eal/windows/getopt.c b/lib/librte_eal/windows/getopt.c
index 170c9b5e0..a08f7c109 100644
--- a/lib/librte_eal/windows/getopt.c
+++ b/lib/librte_eal/windows/getopt.c
@@ -25,8 +25,8 @@ int	opterr = 1;		/* if error message should be printed */
 int	optind = 1;		/* index into parent argv vector */
 int	optopt = '?';		/* character checked for validity */
 
-static void pass(void) {}
-#define warnx(a, ...) pass()
+static void pass(const char *a) {(void) a; }
+#define warnx(a, ...) pass(a)
 
 #define PRINT_ERROR	((opterr) && (*options != ':'))
 
diff --git a/lib/librte_eal/windows/include/pthread.h b/lib/librte_eal/windows/include/pthread.h
index 0bbed5c3b..e2274cf4e 100644
--- a/lib/librte_eal/windows/include/pthread.h
+++ b/lib/librte_eal/windows/include/pthread.h
@@ -45,7 +45,7 @@ typedef SYNCHRONIZATION_BARRIER pthread_barrier_t;
 #define pthread_getaffinity_np(thread, size, cpuset) \
 	eal_get_thread_affinity_mask(thread, (unsigned long *) cpuset)
 #define pthread_create(threadid, threadattr, threadfunc, args) \
-	eal_create_thread(threadid, threadfunc, args)
+	eal_create_thread(threadid, threadattr, threadfunc, args)
 
 static inline int
 eal_set_thread_affinity_mask(pthread_t threadid, unsigned long *cpuset)
@@ -70,8 +70,10 @@ eal_get_thread_affinity_mask(pthread_t threadid, unsigned long *cpuset)
 }
 
 static inline int
-eal_create_thread(void *threadid, void *threadfunc, void *args)
+eal_create_thread(void *threadid, const void *threadattr, void *threadfunc,
+		void *args)
 {
+	RTE_SET_USED(threadattr);
 	HANDLE hThread;
 	hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc,
 		args, 0, (LPDWORD)threadid);
-- 
2.18.0.windows.1


  parent reply	other threads:[~2020-06-11 19:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 22:53 [dpdk-dev] [PATCH] " Pallavi Kadam
2020-05-14  0:43 ` Dmitry Kozlyuk
2020-05-14  1:24   ` Ranjit Menon
2020-05-14  8:02 ` Thomas Monjalon
2020-05-14 17:46   ` Ranjit Menon
2020-05-14 20:39 ` [dpdk-dev] [PATCH v2] " Pallavi Kadam
2020-05-15 19:20   ` Dmitry Kozlyuk
2020-05-18 22:08   ` Narcisa Ana Maria Vasile
2020-05-28 23:14   ` [dpdk-dev] [PATCH v3 0/2] Fix Windows compiler warnings Pallavi Kadam
2020-05-28 23:14     ` [dpdk-dev] [PATCH v3 1/2] eal: fix warnings on Windows Pallavi Kadam
2020-06-11 16:14       ` Thomas Monjalon
2020-06-11 18:55         ` Kadam, Pallavi
2020-05-28 23:14     ` [dpdk-dev] [PATCH v3 2/2] build: treat warning as an error " Pallavi Kadam
2020-06-11 16:12       ` Thomas Monjalon
2020-06-11 18:54         ` Kadam, Pallavi
2020-06-11 19:50     ` Pallavi Kadam [this message]
2020-06-11 20:18       ` [dpdk-dev] [PATCH v4] eal: fix warnings " Narcisa Ana Maria Vasile
2020-06-15  9:37         ` Thomas Monjalon

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=20200611195055.3024-1-pallavi.kadam@intel.com \
    --to=pallavi.kadam@intel.com \
    --cc=Harini.Ramakrishnan@microsoft.com \
    --cc=Narcisa.Vasile@microsoft.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=fady@mellanox.com \
    --cc=ranjit.menon@intel.com \
    --cc=talshn@mellanox.com \
    --cc=tbashar@mellanox.com \
    --cc=thomas@monjalon.net \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git