[v2] eal: fix warnings on Windows
diff mbox series

Message ID 20200514203945.1484-1-pallavi.kadam@intel.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • [v2] eal: fix warnings on Windows
Related show

Checks

Context Check Description
ci/iol-testing fail Testing issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Pallavi Kadam May 14, 2020, 8:39 p.m. UTC
This patch fixes bunch of warnings when compiling on Windows
such as the use of an unsafe string function (strerror),
[-Wunused-const-variable] in getopt.c and
[-Wunused-variable], [-Wunused-function] in eal_common_options.c

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>
Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>
---
 lib/librte_eal/common/eal_common_options.c | 8 +++++++-
 lib/librte_eal/windows/getopt.c            | 4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)

Comments

Dmitry Kozlyuk May 15, 2020, 7:20 p.m. UTC | #1
On Thu, 14 May 2020 13:39:45 -0700
Pallavi Kadam <pallavi.kadam@intel.com> wrote:

> This patch fixes bunch of warnings when compiling on Windows
> such as the use of an unsafe string function (strerror),
> [-Wunused-const-variable] in getopt.c and
> [-Wunused-variable], [-Wunused-function] in eal_common_options.c
> 
> 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>
> Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>
> ---
[snip]

Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>

--
Dmitry Kozlyuk
Narcisa Ana Maria Vasile May 18, 2020, 10:08 p.m. UTC | #2
On Thu, May 14, 2020 at 01:39:45PM -0700, Pallavi Kadam wrote:
> This patch fixes bunch of warnings when compiling on Windows
> such as the use of an unsafe string function (strerror),
> [-Wunused-const-variable] in getopt.c and
> [-Wunused-variable], [-Wunused-function] in eal_common_options.c
> 
> 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>
> Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>
> ---
> 
Glad to see those warnings gone!
Tested with clang, FYI it looks like there's only one warning left. We use "attr" in the pthread_create call, but in the pthread_create macro definition we ignore the attribute parameter.
[13/30] Compiling C object lib/76b5a35@@rte_eal@sta/librte_eal_common_eal_common_thread.c.obj.
../lib/librte_eal/common/eal_common_thread.c:180:25: warning: unused parameter 'attr' [-Wunused-parameter]
                const pthread_attr_t *attr,
                                      ^
1 warning generated.

Otherwise,
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>

Patch
diff mbox series

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/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 != ':'))