don't inline rte_string_fns
PATCH 1/1 don't inline rte_string_fns
The function rte_snprintf() can never be inlined by Gcc.
If compiled with -Winline it generates an error:
function ‘rte_snprintf’ can never be inlined because it uses variable argument lists [-Werror=inline]
Therefore since both rte_snprintf and rte_strsplit are not performance sensitive just move them to being real functions.
--- app/test/test_eal_fs.c | 1 + lib/librte_eal/common/eal_common_string_fns.c | 95 ++++++++++++++++++++++++ lib/librte_eal/common/include/rte_string_fns.h | 58 +-------------- lib/librte_eal/linuxapp/eal/Makefile | 1 + 4 files changed, 101 insertions(+), 54 deletions(-) create mode 100644 lib/librte_eal/common/eal_common_string_fns.c
app/test/test_eal_fs.c +1 -0
@@ -36,6 +36,7 @@#include <stdio.h> #include <stdlib.h> #include <string.h> +#include <errno.h> /* eal_filesystem.h is not a public header file, so use relative path */ #include "../../lib/librte_eal/linuxapp/eal/include/eal_filesystem.h"
lib/librte_eal/common/eal_common_string_fns.c new file +95 -0
95 lines not on this page · raw message
lib/librte_eal/common/include/rte_string_fns.h +4 -54
77 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/Makefile +1 -0
@@ -78,6 +78,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_cpuflags.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_hexdump.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_whitelist.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_nonpci_devs.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_string_fns.c CFLAGS_eal.o := -D_GNU_SOURCE CFLAGS_eal_thread.o := -D_GNU_SOURCE
Signature · 1 line
1.7.10.4
Hi,
I have some minor comments below.
27/02/2014 09:18, Stephen Hemminger :
Quoted 13 lines
The function
rte_snprintf()can never be inlined by Gcc.
If compiled with -Winline it generates an error:
function ‘rte_snprintf’ can never be inlined because it uses variable
argument lists [-Werror=inline]Therefore since both
rte_snprintfandrte_strsplitare not performance sensitive just move them to being real functions.Signed-off-by Stephen Hemminger <[email protected]>
lib/librte_eal/common/eal_common_string_fns.c line 4
Quoted 4 lines
lib/librte_eal/common/eal_common_string_fns.c new file +4
-0@@ -0,0 +1,95 @@ +/*- +* BSD LICENSE +* +* Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
It is now 2014 in version 1.6.0.
[...]
lib/librte_eal/common/eal_common_string_fns.c line 37
Quoted 4 lines
lib/librte_eal/common/eal_common_string_fns.c new file +4
-0+#include <stdio.h> +#include <stdarg.h> +#include <stddef.h> +#include <errno.h>
I think stddef.h is not needed.
[...]
lib/librte_eal/common/include/rte_string_fns.h extern "C" { · line 50
Quoted 7 lines
lib/librte_eal/common/include/rte_string_fns.h +0
-1@@ -47,7 +47,6 @@ extern "C" {#include <stdio.h> #include <stdarg.h> #include <stddef.h> -#include <errno.h>
stdarg and stddef are not needed.
[...]
lib/librte_eal/common/include/rte_string_fns.h extern "C" { · line 76
Quoted 4 lines
lib/librte_eal/common/include/rte_string_fns.h +2
-0+int +rte_snprintf (char *buffer,int buflen,const char *format, ...);
One blank line should be sufficient.
Quoted 2 lines
+int
rte_strsplit(char *string, int stringlen,
Thank you
Signature · 1 line
Thomas
Hi Stephen,
This patch is still pending.
Please send a v2.
2014-03-20 17:30, Thomas Monjalon:
Quoted 62 lines
Hi,
I have some minor comments below.
27/02/2014 09:18, Stephen Hemminger :
Quoted 15 lines
The function
rte_snprintf()can never be inlined by Gcc.If compiled with -Winline it generates an error:
function ‘rte_snprintf’ can never be inlined because it uses variableargument lists [-Werror=inline]
Therefore since both
rte_snprintfandrte_strsplitare not performance sensitive just move them to being real functions.Signed-off-by Stephen Hemminger <[email protected]>lib/librte_eal/common/eal_common_string_fns.c line 4
Quoted 4 lines
lib/librte_eal/common/eal_common_string_fns.c new file +4
-0@@ -0,0 +1,95 @@ +/*- +* BSD LICENSE +* +* Copyright(c) 2010-2013 Intel Corporation. All rights reserved. It is now 2014 in version 1.6.0.
[...]
lib/librte_eal/common/eal_common_string_fns.c line 37
Quoted 4 lines
lib/librte_eal/common/eal_common_string_fns.c new file +4
-0+#include <stdio.h> +#include <stdarg.h> +#include <stddef.h> +#include <errno.h> I think
stddef.his not needed.[...]
lib/librte_eal/common/include/rte_string_fns.h extern "C" { · line 52
Quoted 9 lines
lib/librte_eal/common/include/rte_string_fns.h +0
-1@@ -47,7 +47,6 @@ extern "C" {#include <stdio.h> #include <stdarg.h> #include <stddef.h> -#include <errno.h> stdarg and stddef are not needed.
[...]
lib/librte_eal/common/include/rte_string_fns.h extern "C" { · line 75
Quoted 2 lines
lib/librte_eal/common/include/rte_string_fns.h +2
-0+int +rte_snprintf (char *buffer,int buflen,const char *format, ...);One blank line should be sufficient.
Quoted 3 lines
+int
rte_strsplit(char *string, int stringlen,
Thank you