eal: fix warnings on Windows
PATCH 1/1 eal: fix warnings on Windows
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
--- lib/librte_eal/common/eal_common_options.c | 6 +++++- lib/librte_eal/windows/getopt.c | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-)
lib/librte_eal/common/eal_common_options.c +5 -1
@@ -115,8 +115,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 +331,7 @@ eal_plugin_add(const char *path)return 0 ; } +#ifndef RTE_EXEC_ENV_WINDOWS static int eal_plugindir_init (const char *path) {
@@ -362,6 +365,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 +398,8 @@ eal_plugins_init(void) } } -return 0 ;#endif +return 0 ; }/*
lib/librte_eal/windows/getopt.c +2 -2
@@ -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 != ':'))
Signature · 1 line
2.18.0.windows.1
Quoted 37 lines · On Wed, 13 May 2020 15:53:41 -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.cand [-Wunused-variable], [-Wunused-function] ineal_common_options.cSigned-off-by Ranjit Menon <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>Tested-by Pallavi Kadam <[email protected]>--- lib/librte_eal/common/eal_common_options.c | 6 +++++- lib/librte_eal/windows/getopt.c | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/lib/librte_eal/common/eal_common_options.cindex8f2cbd1c6..2efbf59e4100644 ---a/lib/librte_eal/common/eal_common_options.c+++b/lib/librte_eal/common/eal_common_options.c@@ -115,8 +115,10 @@ structshared_driver{ static structshared_driver_listsolib_list=
TAILQ_HEAD_INITIALIZER(solib_list);lib/librte_eal/common/eal_common_options.c +3
-0+#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 +331,7 @@ eal_plugin_add(const char *path)return 0 ; } +#ifndef RTE_EXEC_ENV_WINDOWS static int eal_plugindir_init (const char *path) {
lib/librte_eal/common/eal_common_options.c eal_plugindir_init(const char *path) · line 368
Quoted 4 lines
lib/librte_eal/common/eal_common_options.c +1
-0@@ -362,6 +365,7 @@ eal_plugindir_init(const char *path)/* XXX this ignores failures from readdir() itself */ return (dent == NULL) ? 0 : -1; } +#endif
This causes different warnings:
In file included from ../../../lib/librte_eal/common/eal_common_options.c:21:
At top level:../../../lib/librte_eal/windows/include/dirent.h:529:1: warning: 'closedir' defined but not used [-Wunused-function]
529 | closedir(DIR *dirp)
| ^~~~~~~~
../../../lib/librte_eal/windows/include/dirent.h:447:1: warning: 'readdir' defined but not used [-Wunused-function]
447 | readdir(DIR *dirp)
| ^~~~~~~
../../../lib/librte_eal/windows/include/dirent.h:377:1: warning: 'opendir' defined but not used [-Wunused-function]
377 | opendir(const char *dirname)
| ^~~~~~~Suggesting not to include <dirent.h> to this file on Windows (this makes dirent.h unused in EAL, but other code will require it later).
Quoted 22 lines
lib/librte_eal/common/eal_common_options.c +1
-1int eal_plugins_init (void )@@ -394,8 +398,8 @@ eal_plugins_init(void) } } -return 0 ;#endif +return 0 ; }/* (quoted diff) +0
-0
b/lib/librte_eal/windows/getopt.cindex170c9b5e0..a08f7c109100644lib/librte_eal/windows/getopt.c +0
-0@@ -25,8 +25,8 @@ int opterr = 1; /* if errormessage should be printed */ int optind = 1; /*
index into parent argv vector */ int optopt = '?';/* character checked for validity */
lib/librte_eal/windows/getopt.c int opterr = 1; /* if error message should be printed */ · line 31
Quoted 6 lines
lib/librte_eal/windows/getopt.c +2
-2-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 != ':'))
Testing with MinGW-w64 (Ubuntu 19.10, package 6.0.0-3, GCC 9.2.1) reveals additional warnings. Never mind fixing them in a separate patch to avoid blocking this one. For the record:
../../../lib/librte_eal/common/eal_common_thread.c:180:25: warning: unused parameter 'attr' [-Wunused-parameter]
../../../lib/librte_eal/windows/eal_lcore.c:30:1: warning: old-style function definition [-Wold-style-definition]
30 | eal_create_cpu_map()
../../../lib/librte_eal/windows/eal_thread.c:149:29: warning: cast between incompatible function types from '__attribute__((noreturn)) void * (*)(void *)' to 'DWORD (*)(void *)' {aka 'long unsigned int (*)(void * '} [-Wcast-function-type]
149 | th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
../../../lib/librte_eal/windows/eal.c:144:1: warning: 'optnone' attribute directive ignored [-Wattributes]
../../../lib/librte_eal/common/eal_common_options.c: In function 'eal_adjust_config':../../../lib/librte_eal/windows/include/sched.h:63:55: warning: 'default_set._bits[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
63 | (dst)->_bits[_i] = (src1)->_bits[_i] & (src2)->_bits[_i]; \
--
Dmitry Kozlyuk
Quoted 57 lines · Dmitry Kozlyuk
Quoted 37 lines · On Wed, 13 May 2020 15:53:41 -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.cand [-Wunused-variable], [-Wunused-function] ineal_common_options.cSigned-off-by Ranjit Menon <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>Tested-by Pallavi Kadam <[email protected]>--- lib/librte_eal/common/eal_common_options.c | 6 +++++- lib/librte_eal/windows/getopt.c | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/lib/librte_eal/common/eal_common_options.cindex8f2cbd1c6..2efbf59e4100644 ---a/lib/librte_eal/common/eal_common_options.c+++b/lib/librte_eal/common/eal_common_options.c@@ -115,8 +115,10 @@ structshared_driver{ static structshared_driver_listsolib_list=
TAILQ_HEAD_INITIALIZER(solib_list);lib/librte_eal/common/eal_common_options.c +3
-0+#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 +331,7 @@ eal_plugin_add(const char *path)return 0 ; } +#ifndef RTE_EXEC_ENV_WINDOWS static int eal_plugindir_init (const char *path) {lib/librte_eal/common/eal_common_options.c eal_plugindir_init(const char *path) · line 368
Quoted 4 lines
lib/librte_eal/common/eal_common_options.c +1
-0@@ -362,6 +365,7 @@ eal_plugindir_init(const char *path)/* XXX this ignores failures from readdir() itself */ return (dent == NULL) ? 0 : -1; } +#endif This causes different warnings:
In file included from
../../../lib/librte_eal/common/eal_common_options.c:21:
At top level:../../../lib/librte_eal/windows/include/dirent.h:529:1: warning: 'closedir' defined but not used [-Wunused-function]
529 |closedir(DIR *dirp)| ^~~~~~~~ ../../../lib/librte_eal/windows/include/dirent.h:447:1: warning: 'readdir' defined but not used [-Wunused-function] 447 | readdir(DIR *dirp) | ^~~~~~~ ../../../lib/librte_eal/windows/include/dirent.h:377:1: warning: 'opendir' defined but not used [-Wunused-function] 377 | opendir(const char *dirname) | ^~~~~~~
Quoted 3 lines
Suggesting not to include <
dirent.h> to this file on Windows (this makesdirent.hunused in EAL, but other code will require it later).
Yes. We saw this too and realized that if we put a #ifndef RTE_EXEC_ENV_WINDOWS around the #include of dirent.h, it would render the file as being unused. But, I think it makes sense to do it - better than having these warnings.
Quoted 41 lines
Quoted 22 lines
lib/librte_eal/common/eal_common_options.c +1
-1int eal_plugins_init (void )@@ -394,8 +398,8 @@ eal_plugins_init(void) } } -return 0 ;#endif +return 0 ; }/* (quoted diff) +0
-0
b/lib/librte_eal/windows/getopt.cindex170c9b5e0..a08f7c109100644lib/librte_eal/windows/getopt.c +0
-0@@ -25,8 +25,8 @@ int opterr = 1; /* if errormessage should be printed */ int optind = 1; /*
index into parent argv vector */ int optopt = '?';/* character checked for validity */lib/librte_eal/windows/getopt.c int opterr = 1; /* if error message should be printed */ · line 31
Quoted 6 lines
lib/librte_eal/windows/getopt.c +2
-2-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 != ':'))Testing with MinGW-w64 (Ubuntu 19.10, package 6.0.0-3, GCC 9.2.1) reveals additional warnings. Never mind fixing them in a separate patch to avoid blocking this one. For the record:
../../../lib/librte_eal/common/eal_common_thread.c:180:25: warning: unused parameter 'attr' [-Wunused-parameter]
../../../lib/librte_eal/windows/eal_lcore.c:30:1: warning: old-style function definition [-Wold-style-definition]30 | eal_create_cpu_map()
../../../lib/librte_eal/windows/eal_thread.c:149:29: warning: cast between incompatible function types from '__attribute__((noreturn)) void * (*)(void *)' to 'DWORD (*)(void *)' {aka 'long unsigned int (*)(void * '} [-Wcast-function-type]
149 | th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop,
Quoted 9 lines
../../../lib/librte_eal/windows/eal.c:144:1: warning: 'optnone' attribute directive ignored [-Wattributes]
../../../lib/librte_eal/common/eal_common_options.c: In function 'eal_adjust_config':../../../lib/librte_eal/windows/include/sched.h:63:55: warning: 'default_set._bits[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]63 | (dst)->_bits[_i] = (src1)->_bits[_i] & (src2)->_bits[_i]; \--
Dmitry Kozlyuk
Yes, we can address this in a separate patch.
ranjit m.
14/05/2020 00:53, Pallavi Kadam:
Quoted 5 lines
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.cand [-Wunused-variable], [-Wunused-function] ineal_common_options.c
Quoted 7 lines
Signed-off-by Ranjit Menon <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>Tested-by Pallavi Kadam <[email protected]>---
+#ifndefRTE_EXEC_ENV_WINDOWS
static int
eal_plugindir_init(const char *path)
Why disabling the plugin mechanism?
Can we make it working instead?
PS: When sending patches for Windows, please Cc the official Windows maintainers and Dmitry Kozliuk.
Quoted 14 lines · Thomas Monjalon
14/05/2020 00:53, Pallavi Kadam:
Quoted 5 lines
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.cand [-Wunused-variable], [-Wunused-function] ineal_common_options.cQuoted 7 lines
Signed-off-by Ranjit Menon <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>Tested-by Pallavi Kadam <[email protected]>---
+#ifndefRTE_EXEC_ENV_WINDOWS
static int
eal_plugindir_init(const char *path)
Quoted 3 lines
Why disabling the plugin mechanism?
Can we make it working instead?
The function that is calling eal_plugindir_init() has already been #ifndef-ed out for Windows compilation. So, this function will never be called on Windows and was the cause of multiple compilation warnings. Best to keep it disabled until we can have this implemented and working on Windows
Quoted 4 lines
PS: When sending patches for Windows, please Cc the official Windows maintainers and Dmitry Kozliuk.
Yes. Will do.
ranjit m.
PATCH v2 1/1 eal: fix warnings on Windows
In reply to Pallavi KadamThis 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)
--- lib/librte_eal/common/eal_common_options.c | 8 +++++++- lib/librte_eal/windows/getopt.c | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-)
lib/librte_eal/common/eal_common_options.c +7 -1
@@ -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 ; }/*
lib/librte_eal/windows/getopt.c +2 -2
@@ -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 != ':'))
Signature · 1 line
2.18.0.windows.1
Quoted 13 lines · On Thu, 14 May 2020 13:39:45 -0700 Pallavi Kadam <[email protected]>…
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.cand [-Wunused-variable], [-Wunused-function] ineal_common_options.cv2 changes:
Excludeddirent.hfile on Windows temporarily. (This file will stay on Windows for later use)Signed-off-by Ranjit Menon <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>Tested-by Pallavi Kadam <[email protected]>---
[snip]
--
Dmitry Kozlyuk
Quoted 5 lines · Pallavi Kadam
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.cand [-Wunused-variable], [-Wunused-function] ineal_common_options.c
Quoted 9 lines
v2 changes:
Excludeddirent.hfile on Windows temporarily. (This file will stay on Windows for later use)Signed-off-by Ranjit Menon <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>Tested-by Pallavi Kadam <[email protected]>---
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,
v3 cover Fix Windows compiler warnings
In reply to Pallavi KadamThis patchset fixes all the Windows compiler warnings generated using Clang and MinGW compiler.
Henceforth, all the warnings will be treated as errors on Windows.
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)
Pallavi Kadam (2):
eal: fix warnings on Windows
build: treat warning as an error on Windows
config/meson.build | 4 ++++ 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 ++++-- 7 files changed, 21 insertions(+), 8 deletions(-)
Signature · 1 line
2.18.0.windows.1
PATCH v3 1/2 eal: fix warnings on Windows
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]
--- 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(-)
lib/librte_eal/common/eal_common_options.c +7 -1
@@ -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 ; }/*
lib/librte_eal/windows/eal.c +1 -1
@@ -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;
lib/librte_eal/windows/eal_lcore.c +1 -1
@@ -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 );
lib/librte_eal/windows/eal_thread.c +2 -1
@@ -146,7 +146,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 ;
lib/librte_eal/windows/getopt.c +2 -2
@@ -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 != ':'))
lib/librte_eal/windows/include/pthread.h +4 -2
@@ -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);
Signature · 1 line
2.18.0.windows.1
29/05/2020 01:14, Pallavi Kadam:
Quoted 9 lines
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] ingetopt.cand [-Wunused-parameter] ineal_common_thread.c.
Also fixed warnings generated using Mingw:
[-Werror=old-style-definition], [-Werror=cast-function-type] and [-Werror=attributes]
Quoted 3 lines
Signed-off-by Ranjit Menon <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>Tested-by Pallavi Kadam <[email protected]>
Tested-by is useless if you are the author of the patch.
Quoted 7 lines
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(-)
There were some changes since v2 which were not reviewed. Someone please?
Quoted 10 lines · Thomas Monjalon
29/05/2020 01:14, Pallavi Kadam:
Quoted 9 lines
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] ingetopt.cand [-Wunused-parameter] ineal_common_thread.c.
Also fixed warnings generated using Mingw:
[-Werror=old-style-definition], [-Werror=cast-function-type] and [-Werror=attributes]
Quoted 6 lines
Quoted 3 lines
Signed-off-by Ranjit Menon <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>Tested-by Pallavi Kadam <[email protected]>Tested-by is useless if you are the author of the patch.
Sorry for this, will remove the tag in v4.
Quoted 12 lines
Quoted 7 lines
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(-)There were some changes since v2 which were not reviewed. Someone please?
PATCH v3 2/2 build: treat warning as an error on Windows
In reply to Pallavi KadamAdded -Werror in meson file to consider all the warnings as errors on Windows.
--- config/meson.build | 4 ++++ 1 file changed, 4 insertions(+)
config/meson.build +4 -0
@@ -208,6 +208,10 @@ warning_flags = [ '-Wno-packed-not-aligned', '-Wno-missing-field-initializers' ] +# add -Werror to treat warnings as errors on Windows +if is_windows + warning_flags += '-Werror' +endif if cc.get_id() == 'gcc' and cc.version().version_compare('>=10.0') # FIXME: Bugzilla 396 warning_flags += '-Wno-zero-length-bounds'
Signature · 1 line
2.18.0.windows.1
Re: [dpdk-dev] [PATCH v3 2/2] build: treat warning as an error on Windows
29/05/2020 01:14, Pallavi Kadam:
config/meson.build warning_flags = [ · line 214
Quoted 12 lines
Added -Werror in meson file to consider all the warnings as errors on Windows.
Signed-off-by Pallavi Kadam <[email protected]>Reviewed-by Ranjit Menon <[email protected]>---
config/meson.build +4
-0+# add -Werror to treat warnings as errors on Windows +if is_windows + warning_flags += '-Werror' +endif
This should be not needed.
When configuring meson in a CI, we are supposed to use --werror as it is done in devtools/test-meson-builds.sh.
Re: [dpdk-dev] [PATCH v3 2/2] build: treat warning as an error on Windows
Quoted 4 lines · Thomas Monjalon
29/05/2020 01:14, Pallavi Kadam:
Quoted 3 lines
Added -Werror in meson file to consider all the warnings as errors on Windows.
Quoted 16 lines
config/meson.build warning_flags = [ · line 214
Quoted 9 lines
Signed-off-by Pallavi Kadam <[email protected]>Reviewed-by Ranjit Menon <[email protected]>---
config/meson.build +4
-0+# add -Werror to treat warnings as errors on Windows +if is_windows + warning_flags += '-Werror' +endifThis should be not needed.
When configuring meson in a CI, we are supposed to use --werror as it is done indevtools/test-meson-builds.sh.
Ok, will fix this in v4.
PATCH v4 1/1 eal: fix warnings on Windows
In reply to Pallavi KadamFixed 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)
--- 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(-)
lib/librte_eal/common/eal_common_options.c +7 -1
@@ -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 ; }/*
lib/librte_eal/windows/eal.c +1 -1
@@ -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;
lib/librte_eal/windows/eal_lcore.c +1 -1
@@ -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 );
lib/librte_eal/windows/eal_thread.c +2 -1
@@ -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 ;
lib/librte_eal/windows/getopt.c +2 -2
@@ -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 != ':'))
lib/librte_eal/windows/include/pthread.h +4 -2
@@ -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);
Signature · 1 line
2.18.0.windows.1
Quoted 18 lines · Pallavi Kadam
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] ingetopt.cand [-Wunused-parameter] ineal_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' linev3 changes:
Fixed pthread warning
Added -Werror on Windows
Fixed MinGW warnings
Quoted 7 lines
v2 changes:
Excludeddirent.hfile on Windows temporarily. (This file will stay on Windows for later use)Signed-off-by Ranjit Menon <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>---
Tested with clang, no warnings generated.
Thomas Monjalon
Applied11/06/2020 22:18, Narcisa Ana Maria Vasile:
Quoted 23 lines · Pallavi Kadam
Quoted 22 lines
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] ingetopt.cand [-Wunused-parameter] ineal_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' linev3 changes:
Fixed pthread warning
Added -Werror on Windows
Fixed MinGW warningsv2 changes:
Excludeddirent.hfile on Windows temporarily. (This file will stay on Windows for later use)
Quoted 6 lines
Quoted 3 lines
Signed-off-by Ranjit Menon <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>---
Tested with clang, no warnings generated.
Tested-by Narcisa Vasile <[email protected]>Acked-by Narcisa Vasile <[email protected]>
Applied, thanks