[dpdk-dev,07/10] lib: fix missing include dependencies
Commit Message
Exported header files for use by applications should be self sufficient and
allow out of order inclusion. Moreover, they must include all the system
headers they need for types and macros.
This commit prevents the following errors:
error: `RTE_MAX_LCORE' undeclared here (not in a function)
error: `RTE_LPM_VALID_EXT_ENTRY_BITMASK' undeclared (first use in this function)
error: #error "Unsupported cache line size"
error: `asm' undeclared (first use in this function)
error: implicit declaration of function `[...]'
error: unknown type name `[...]'
error: field `mac_addr' has incomplete type
error: `CHAR_BIT' undeclared here (not in a function)
error: `struct timespec' declared inside parameter list
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
lib/librte_cfgfile/rte_cfgfile.h | 2 ++
lib/librte_cmdline/cmdline.h | 1 +
lib/librte_cmdline/cmdline_parse_portlist.h | 1 +
lib/librte_cmdline/cmdline_socket.h | 3 +++
lib/librte_eal/common/include/arch/arm/rte_byteorder.h | 3 +++
lib/librte_eal/common/include/arch/arm/rte_prefetch_32.h | 2 ++
lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h | 2 ++
lib/librte_eal/common/include/arch/arm/rte_vect.h | 1 +
lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h | 2 ++
lib/librte_eal/common/include/arch/ppc_64/rte_byteorder.h | 2 ++
lib/librte_eal/common/include/arch/ppc_64/rte_prefetch.h | 2 ++
lib/librte_eal/common/include/arch/x86/rte_atomic.h | 3 +++
lib/librte_eal/common/include/arch/x86/rte_atomic_32.h | 6 ++++++
lib/librte_eal/common/include/arch/x86/rte_atomic_64.h | 8 ++++++++
lib/librte_eal/common/include/arch/x86/rte_byteorder.h | 3 +++
lib/librte_eal/common/include/arch/x86/rte_byteorder_32.h | 7 +++++++
lib/librte_eal/common/include/arch/x86/rte_byteorder_64.h | 7 +++++++
lib/librte_eal/common/include/arch/x86/rte_prefetch.h | 2 ++
lib/librte_eal/common/include/arch/x86/rte_rtm.h | 1 +
lib/librte_eal/common/include/arch/x86/rte_vect.h | 2 ++
lib/librte_eal/common/include/generic/rte_atomic.h | 1 +
lib/librte_eal/common/include/generic/rte_byteorder.h | 2 ++
lib/librte_eal/common/include/rte_eal.h | 1 +
lib/librte_eal/common/include/rte_memory.h | 2 ++
lib/librte_eal/common/include/rte_time.h | 8 ++++++++
lib/librte_eal/common/include/rte_version.h | 1 +
lib/librte_ether/rte_dev_info.h | 2 ++
lib/librte_ether/rte_eth_ctrl.h | 4 ++++
lib/librte_lpm/rte_lpm6.h | 2 ++
lib/librte_lpm/rte_lpm_neon.h | 1 +
lib/librte_lpm/rte_lpm_sse.h | 1 +
lib/librte_reorder/rte_reorder.h | 2 ++
lib/librte_sched/rte_bitmap.h | 1 +
lib/librte_sched/rte_reciprocal.h | 2 ++
lib/librte_sched/rte_sched_common.h | 2 ++
35 files changed, 92 insertions(+)
Comments
Hello Adrien,
just quickly skimming through the ARM fixes...
On Tue, 5 Apr 2016 16:08:07 +0200
Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
> Exported header files for use by applications should be self sufficient and
> allow out of order inclusion. Moreover, they must include all the system
> headers they need for types and macros.
>
> This commit prevents the following errors:
>
> error: `RTE_MAX_LCORE' undeclared here (not in a function)
> error: `RTE_LPM_VALID_EXT_ENTRY_BITMASK' undeclared (first use in this function)
> error: #error "Unsupported cache line size"
> error: `asm' undeclared (first use in this function)
> error: implicit declaration of function `[...]'
> error: unknown type name `[...]'
> error: field `mac_addr' has incomplete type
> error: `CHAR_BIT' undeclared here (not in a function)
> error: `struct timespec' declared inside parameter list
>
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>
> ---
[...]
> +
> #ifdef __cplusplus
> extern "C" {
> #endif
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_byteorder.h b/lib/librte_eal/common/include/arch/arm/rte_byteorder.h
> index 3f2dd1f..c2078e7 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_byteorder.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_byteorder.h
> @@ -37,6 +37,9 @@
> # error Platform must be built with CONFIG_RTE_FORCE_INTRINSICS
> #endif
>
> +#include <stdint.h>
> +#include <rte_common.h>
Why not to place it into the extern "C" { block? There is already:
#include "generic/rte_byteorder.h"
> +
> #ifdef __cplusplus
> extern "C" {
> #endif
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_prefetch_32.h b/lib/librte_eal/common/include/arch/arm/rte_prefetch_32.h
> index 5aeed22..29b831b 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_prefetch_32.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_prefetch_32.h
> @@ -33,6 +33,8 @@
> #ifndef _RTE_PREFETCH_ARM32_H_
> #define _RTE_PREFETCH_ARM32_H_
>
> +#include <rte_common.h>
I don't see any reason for this. The header does not use anything
special. Just "asm", but that should be a keyword...
> +
> #ifdef __cplusplus
> extern "C" {
> #endif
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
> index 3ed46a4..600c6f0 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
> @@ -33,6 +33,8 @@
> #ifndef _RTE_PREFETCH_ARM_64_H_
> #define _RTE_PREFETCH_ARM_64_H_
>
> +#include <rte_common.h>
Same here.
> +
> #ifdef __cplusplus
> extern "C" {
> #endif
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_vect.h b/lib/librte_eal/common/include/arch/arm/rte_vect.h
> index a33c054..b86c2cf 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_vect.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_vect.h
> @@ -33,6 +33,7 @@
> #ifndef _RTE_VECT_ARM_H_
> #define _RTE_VECT_ARM_H_
>
> +#include <stdint.h>
> #include "arm_neon.h"
>
> #ifdef __cplusplus
[...]
Regards
Jan
Hi Jan,
Replying below as well.
On Tue, Apr 05, 2016 at 10:23:04PM +0200, Jan Viktorin wrote:
> Hello Adrien,
>
> just quickly skimming through the ARM fixes...
>
> On Tue, 5 Apr 2016 16:08:07 +0200
> Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
>
> > Exported header files for use by applications should be self sufficient and
> > allow out of order inclusion. Moreover, they must include all the system
> > headers they need for types and macros.
> >
> > This commit prevents the following errors:
> >
> > error: `RTE_MAX_LCORE' undeclared here (not in a function)
> > error: `RTE_LPM_VALID_EXT_ENTRY_BITMASK' undeclared (first use in this function)
> > error: #error "Unsupported cache line size"
> > error: `asm' undeclared (first use in this function)
> > error: implicit declaration of function `[...]'
> > error: unknown type name `[...]'
> > error: field `mac_addr' has incomplete type
> > error: `CHAR_BIT' undeclared here (not in a function)
> > error: `struct timespec' declared inside parameter list
> >
> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> >
> > ---
> [...]
> > +
> > #ifdef __cplusplus
> > extern "C" {
> > #endif
> > diff --git a/lib/librte_eal/common/include/arch/arm/rte_byteorder.h b/lib/librte_eal/common/include/arch/arm/rte_byteorder.h
> > index 3f2dd1f..c2078e7 100644
> > --- a/lib/librte_eal/common/include/arch/arm/rte_byteorder.h
> > +++ b/lib/librte_eal/common/include/arch/arm/rte_byteorder.h
> > @@ -37,6 +37,9 @@
> > # error Platform must be built with CONFIG_RTE_FORCE_INTRINSICS
> > #endif
> >
> > +#include <stdint.h>
> > +#include <rte_common.h>
>
> Why not to place it into the extern "C" { block? There is already:
>
> #include "generic/rte_byteorder.h"
Right, I did not do it because headers may eventually contain C++
compatibility code someday, so I think we should avoid #includes inside
extern "C" blocks. C++ compliant headers should provide their own blocks,
also I'm not sure how well it mixes with system includes having their own
compatibility layer.
I agree we need consistency, so what about a commit to move all #includes
outside of such blocks instead?
> > +#include <rte_common.h>
>
> I don't see any reason for this. The header does not use anything
> special. Just "asm", but that should be a keyword...
Unfortunately it's a nonstandard keyword which is defined as __asm__ in
rte_common.h, itself an extension keyword compilers will swallow without
complaining thanks to these "__".
> > #ifdef __cplusplus
> > extern "C" {
> > #endif
> > diff --git a/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
> > index 3ed46a4..600c6f0 100644
> > --- a/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
> > +++ b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
> > @@ -33,6 +33,8 @@
> > #ifndef _RTE_PREFETCH_ARM_64_H_
> > #define _RTE_PREFETCH_ARM_64_H_
> >
> > +#include <rte_common.h>
>
> Same here.
Same reason here.
On Wed, 6 Apr 2016 10:54:14 +0200
Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
> Hi Jan,
>
> Replying below as well.
>
[...]
> > > --- a/lib/librte_eal/common/include/arch/arm/rte_byteorder.h
> > > +++ b/lib/librte_eal/common/include/arch/arm/rte_byteorder.h
> > > @@ -37,6 +37,9 @@
> > > # error Platform must be built with CONFIG_RTE_FORCE_INTRINSICS
> > > #endif
> > >
> > > +#include <stdint.h>
> > > +#include <rte_common.h>
> >
> > Why not to place it into the extern "C" { block? There is already:
> >
> > #include "generic/rte_byteorder.h"
>
> Right, I did not do it because headers may eventually contain C++
> compatibility code someday, so I think we should avoid #includes inside
> extern "C" blocks. C++ compliant headers should provide their own blocks,
> also I'm not sure how well it mixes with system includes having their own
> compatibility layer.
>
> I agree we need consistency, so what about a commit to move all #includes
> outside of such blocks instead?
Yes, I agree.
>
> > > +#include <rte_common.h>
> >
> > I don't see any reason for this. The header does not use anything
> > special. Just "asm", but that should be a keyword...
>
> Unfortunately it's a nonstandard keyword which is defined as __asm__ in
> rte_common.h, itself an extension keyword compilers will swallow without
> complaining thanks to these "__".
OK.
>
> > > #ifdef __cplusplus
> > > extern "C" {
> > > #endif
> > > diff --git a/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
> > > index 3ed46a4..600c6f0 100644
> > > --- a/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
> > > +++ b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
> > > @@ -33,6 +33,8 @@
> > > #ifndef _RTE_PREFETCH_ARM_64_H_
> > > #define _RTE_PREFETCH_ARM_64_H_
> > >
> > > +#include <rte_common.h>
> >
> > Same here.
>
> Same reason here.
OK.
Regards
Jan
@@ -34,6 +34,8 @@
#ifndef __INCLUDE_RTE_CFGFILE_H__
#define __INCLUDE_RTE_CFGFILE_H__
+#include <stddef.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -63,6 +63,7 @@
#include <termios.h>
#include <cmdline_rdline.h>
+#include <cmdline_parse.h>
/**
* @file
@@ -61,6 +61,7 @@
#ifndef _PARSE_PORTLIST_H_
#define _PARSE_PORTLIST_H_
+#include <stdint.h>
#include <cmdline_parse.h>
#ifdef __cplusplus
@@ -61,6 +61,9 @@
#ifndef _CMDLINE_SOCKET_H_
#define _CMDLINE_SOCKET_H_
+#include <cmdline_parse.h>
+#include <cmdline.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -37,6 +37,9 @@
# error Platform must be built with CONFIG_RTE_FORCE_INTRINSICS
#endif
+#include <stdint.h>
+#include <rte_common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -33,6 +33,8 @@
#ifndef _RTE_PREFETCH_ARM32_H_
#define _RTE_PREFETCH_ARM32_H_
+#include <rte_common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -33,6 +33,8 @@
#ifndef _RTE_PREFETCH_ARM_64_H_
#define _RTE_PREFETCH_ARM_64_H_
+#include <rte_common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -33,6 +33,7 @@
#ifndef _RTE_VECT_ARM_H_
#define _RTE_VECT_ARM_H_
+#include <stdint.h>
#include "arm_neon.h"
#ifdef __cplusplus
@@ -42,6 +42,8 @@
#ifndef _RTE_ATOMIC_PPC_64_H_
#define _RTE_ATOMIC_PPC_64_H_
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -38,6 +38,8 @@
#ifndef _RTE_BYTEORDER_PPC_64_H_
#define _RTE_BYTEORDER_PPC_64_H_
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -33,6 +33,8 @@
#ifndef _RTE_PREFETCH_PPC_64_H_
#define _RTE_PREFETCH_PPC_64_H_
+#include <rte_common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -34,6 +34,9 @@
#ifndef _RTE_ATOMIC_X86_H_
#define _RTE_ATOMIC_X86_H_
+#include <stdint.h>
+#include <rte_common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -37,10 +37,16 @@
* All rights reserved.
*/
+#ifndef _RTE_ATOMIC_X86_H_
+#error do not include this file directly, use <rte_atomic.h> instead
+#endif
+
#ifndef _RTE_ATOMIC_I686_H_
#define _RTE_ATOMIC_I686_H_
+#include <stdint.h>
#include <rte_common.h>
+#include <rte_atomic.h>
/*------------------------- 64 bit atomic operations -------------------------*/
@@ -37,9 +37,17 @@
* All rights reserved.
*/
+#ifndef _RTE_ATOMIC_X86_H_
+#error do not include this file directly, use <rte_atomic.h> instead
+#endif
+
#ifndef _RTE_ATOMIC_X86_64_H_
#define _RTE_ATOMIC_X86_64_H_
+#include <stdint.h>
+#include <rte_common.h>
+#include <rte_atomic.h>
+
/*------------------------- 64 bit atomic operations -------------------------*/
#ifndef RTE_FORCE_INTRINSICS
@@ -34,6 +34,9 @@
#ifndef _RTE_BYTEORDER_X86_H_
#define _RTE_BYTEORDER_X86_H_
+#include <stdint.h>
+#include <rte_common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -31,9 +31,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _RTE_BYTEORDER_X86_H_
+#error do not include this file directly, use <rte_byteorder.h> instead
+#endif
+
#ifndef _RTE_BYTEORDER_I686_H_
#define _RTE_BYTEORDER_I686_H_
+#include <stdint.h>
+#include <rte_byteorder.h>
+
/*
* An architecture-optimized byte swap for a 64-bit value.
*
@@ -31,9 +31,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _RTE_BYTEORDER_X86_H_
+#error do not include this file directly, use <rte_byteorder.h> instead
+#endif
+
#ifndef _RTE_BYTEORDER_X86_64_H_
#define _RTE_BYTEORDER_X86_64_H_
+#include <stdint.h>
+#include <rte_common.h>
+
/*
* An architecture-optimized byte swap for a 64-bit value.
*
@@ -34,6 +34,8 @@
#ifndef _RTE_PREFETCH_X86_64_H_
#define _RTE_PREFETCH_X86_64_H_
+#include <rte_common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -20,6 +20,7 @@
/* Official RTM intrinsics interface matching gcc/icc, but works
on older gcc compatible compilers and binutils. */
+#include <rte_common.h>
#ifdef __cplusplus
extern "C" {
@@ -40,6 +40,8 @@
* RTE SSE/AVX related header.
*/
+#include <stdint.h>
+
#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
#ifdef __SSE__
@@ -42,6 +42,7 @@
*/
#include <stdint.h>
+#include <rte_common.h>
#ifdef __DOXYGEN__
@@ -50,6 +50,8 @@
#include <endian.h>
#endif
+#include <rte_common.h>
+
/*
* Compile-time endianness detection
*/
@@ -44,6 +44,7 @@
#include <sched.h>
#include <rte_per_lcore.h>
+#include <rte_config.h>
#ifdef __cplusplus
extern "C" {
@@ -44,6 +44,8 @@
#include <stddef.h>
#include <stdio.h>
+#include <rte_config.h>
+
#ifdef RTE_EXEC_ENV_LINUXAPP
#include <exec-env/rte_dom0_common.h>
#endif
@@ -31,6 +31,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _RTE_TIME_H_
+#define _RTE_TIME_H_
+
+#include <stdint.h>
+#include <time.h>
+
#define NSEC_PER_SEC 1000000000L
/**
@@ -120,3 +126,5 @@ rte_ns_to_timespec(uint64_t nsec)
return ts;
}
+
+#endif /* _RTE_TIME_H_ */
@@ -45,6 +45,7 @@ extern "C" {
#include <stdint.h>
#include <string.h>
+#include <stdio.h>
#include <rte_common.h>
/**
@@ -34,6 +34,8 @@
#ifndef _RTE_DEV_INFO_H_
#define _RTE_DEV_INFO_H_
+#include <stdint.h>
+
/*
* Placeholder for accessing device registers
*/
@@ -34,6 +34,10 @@
#ifndef _RTE_ETH_CTRL_H_
#define _RTE_ETH_CTRL_H_
+#include <stdint.h>
+#include <rte_common.h>
+#include <rte_ether.h>
+
/**
* @file
*
@@ -38,6 +38,8 @@
* RTE Longest Prefix Match for IPv6 (LPM6)
*/
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -43,6 +43,7 @@
#include <rte_byteorder.h>
#include <rte_common.h>
#include <rte_vect.h>
+#include <rte_lpm.h>
#ifdef __cplusplus
extern "C" {
@@ -38,6 +38,7 @@
#include <rte_byteorder.h>
#include <rte_common.h>
#include <rte_vect.h>
+#include <rte_lpm.h>
#ifdef __cplusplus
extern "C" {
@@ -44,6 +44,8 @@
*
*/
+#include <rte_mbuf.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -64,6 +64,7 @@ extern "C" {
*
***/
+#include <string.h>
#include <rte_common.h>
#include <rte_debug.h>
#include <rte_memory.h>
@@ -22,6 +22,8 @@
#ifndef _RTE_RECIPROCAL_H_
#define _RTE_RECIPROCAL_H_
+#include <stdint.h>
+
struct rte_reciprocal {
uint32_t m;
uint8_t sh1, sh2;
@@ -34,6 +34,8 @@
#ifndef __INCLUDE_RTE_SCHED_COMMON_H__
#define __INCLUDE_RTE_SCHED_COMMON_H__
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif