Le 29/07/2013 14:44, Thomas Monjalon a ?crit :
> GCC 4.8 was producing this error:
> argument to ?sizeof? in ?strncmp? call is the same expression as the
> second source; did you mean to provide an explicit length?
> [-Werror=sizeof-pointer-memaccess]
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
> ---
> app/test/test_cmdline_string.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/app/test/test_cmdline_string.c b/app/test/test_cmdline_string.c
> index 7b358cf..84a82ce 100644
> --- a/app/test/test_cmdline_string.c
> +++ b/app/test/test_cmdline_string.c
> @@ -383,7 +383,7 @@ test_parse_string_valid(void)
> return -1;
> }
> if (strncmp(buf, string_elt_strs[i].result,
> - sizeof(string_elt_strs[i].result)) != 0) {
> + sizeof(buf)) != 0) {
In fact, it seems you can use strcmp() instead of strncmp(). Or, if the
intention was really to check the length, use strlen(), but this one will not
include the last '\0'.
- [dpdk-dev] [PATCH 0/4] build fixes for recent distros Thomas Monjalon
- [dpdk-dev] [PATCH 1/4] kni: fix build with kernel 3.8 Thomas Monjalon
- [dpdk-dev] [PATCH 1/4] kni: fix build with kernel... Nicolas Dichtel
- [dpdk-dev] [PATCH 2/4] kni: fix build with kernel 3.9 Thomas Monjalon
- [dpdk-dev] [PATCH 2/4] kni: fix build with kernel... Nicolas Dichtel
- [dpdk-dev] [PATCH 2/4] kni: fix build with ke... Thomas Monjalon
- [dpdk-dev] [PATCH 3/4] kni: fix build with kernel 3.1... Thomas Monjalon
- [dpdk-dev] [PATCH 3/4] kni: fix build with kernel... Nicolas Dichtel
- [dpdk-dev] [PATCH 3/4] kni: fix build with ke... Thomas Monjalon
- [dpdk-dev] [PATCH 4/4] app: fix build with gcc 4.8 Thomas Monjalon
- [dpdk-dev] [PATCH 4/4] app: fix build with gcc 4.... Nicolas Dichtel
- [dpdk-dev] [PATCH v2 0/4] build fixes for recent dist... Thomas Monjalon
- [dpdk-dev] [PATCH v2 1/4] kni: fix build with ker... Thomas Monjalon
- [dpdk-dev] [PATCH v2 1/4] kni: fix build with... Nicolas Dichtel
- [dpdk-dev] [PATCH v2 1/4] kni: fix build ... Thomas Monjalon
- [dpdk-dev] [PATCH v2 2/4] kni: fix build with ker... Thomas Monjalon
- [dpdk-dev] [PATCH v2 3/4] kni: fix build with ker... Thomas Monjalon
- [dpdk-dev] [PATCH v2 4/4] app: fix build with gcc... Thomas Monjalon
- [dpdk-dev] [PATCH v2 4/4] app: fix build with... Nicolas Dichtel
- [dpdk-dev] [PATCH v2 4/4] app: fix build ... Thomas Monjalon

