Skip to content

Commit

Permalink
lib: add missing include dependencies
Browse files Browse the repository at this point in the history
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 [...]' declared inside parameter list
 error: unknown type name `uint8_t'

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
  • Loading branch information
am6 authored and Thomas Monjalon committed Sep 13, 2016
1 parent 79d6f5f commit f04519d
Show file tree
Hide file tree
Showing 35 changed files with 84 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/librte_cfgfile/rte_cfgfile.h
Expand Up @@ -34,6 +34,8 @@
#ifndef __INCLUDE_RTE_CFGFILE_H__
#define __INCLUDE_RTE_CFGFILE_H__

#include <stddef.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
1 change: 1 addition & 0 deletions lib/librte_cmdline/cmdline.h
Expand Up @@ -63,6 +63,7 @@

#include <termios.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>

/**
* @file
Expand Down
1 change: 1 addition & 0 deletions lib/librte_cmdline/cmdline_parse_portlist.h
Expand Up @@ -61,6 +61,7 @@
#ifndef _PARSE_PORTLIST_H_
#define _PARSE_PORTLIST_H_

#include <stdint.h>
#include <cmdline_parse.h>

#ifdef __cplusplus
Expand Down
3 changes: 3 additions & 0 deletions lib/librte_cmdline/cmdline_socket.h
Expand Up @@ -61,6 +61,9 @@
#ifndef _CMDLINE_SOCKET_H_
#define _CMDLINE_SOCKET_H_

#include <cmdline_parse.h>
#include <cmdline.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
2 changes: 2 additions & 0 deletions lib/librte_eal/common/include/arch/arm/rte_byteorder.h
Expand Up @@ -41,6 +41,8 @@
extern "C" {
#endif

#include <stdint.h>
#include <rte_common.h>
#include "generic/rte_byteorder.h"

/* fix missing __builtin_bswap16 for gcc older then 4.8 */
Expand Down
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/arch/arm/rte_prefetch_32.h
Expand Up @@ -37,6 +37,7 @@
extern "C" {
#endif

#include <rte_common.h>
#include "generic/rte_prefetch.h"

static inline void rte_prefetch0(const volatile void *p)
Expand Down
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
Expand Up @@ -37,6 +37,7 @@
extern "C" {
#endif

#include <rte_common.h>
#include "generic/rte_prefetch.h"

static inline void rte_prefetch0(const volatile void *p)
Expand Down
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/arch/arm/rte_vect.h
Expand Up @@ -33,6 +33,7 @@
#ifndef _RTE_VECT_ARM_H_
#define _RTE_VECT_ARM_H_

#include <stdint.h>
#include "arm_neon.h"

#ifdef __cplusplus
Expand Down
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
Expand Up @@ -46,6 +46,7 @@
extern "C" {
#endif

#include <stdint.h>
#include "generic/rte_atomic.h"

/**
Expand Down
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/arch/ppc_64/rte_byteorder.h
Expand Up @@ -42,6 +42,7 @@
extern "C" {
#endif

#include <stdint.h>
#include "generic/rte_byteorder.h"

/*
Expand Down
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/arch/ppc_64/rte_prefetch.h
Expand Up @@ -37,6 +37,7 @@
extern "C" {
#endif

#include <rte_common.h>
#include "generic/rte_prefetch.h"

static inline void rte_prefetch0(const volatile void *p)
Expand Down
2 changes: 2 additions & 0 deletions lib/librte_eal/common/include/arch/x86/rte_atomic.h
Expand Up @@ -38,6 +38,8 @@
extern "C" {
#endif

#include <stdint.h>
#include <rte_common.h>
#include <emmintrin.h>
#include "generic/rte_atomic.h"

Expand Down
6 changes: 6 additions & 0 deletions lib/librte_eal/common/include/arch/x86/rte_atomic_32.h
Expand Up @@ -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 -------------------------*/

Expand Down
8 changes: 8 additions & 0 deletions lib/librte_eal/common/include/arch/x86/rte_atomic_64.h
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/librte_eal/common/include/arch/x86/rte_byteorder.h
Expand Up @@ -38,6 +38,8 @@
extern "C" {
#endif

#include <stdint.h>
#include <rte_common.h>
#include "generic/rte_byteorder.h"

#ifndef RTE_BYTE_ORDER
Expand Down
7 changes: 7 additions & 0 deletions lib/librte_eal/common/include/arch/x86/rte_byteorder_32.h
Expand Up @@ -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.
*
Expand Down
7 changes: 7 additions & 0 deletions lib/librte_eal/common/include/arch/x86/rte_byteorder_64.h
Expand Up @@ -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.
*
Expand Down
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/arch/x86/rte_prefetch.h
Expand Up @@ -38,6 +38,7 @@
extern "C" {
#endif

#include <rte_common.h>
#include "generic/rte_prefetch.h"

static inline void rte_prefetch0(const volatile void *p)
Expand Down
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/arch/x86/rte_rtm.h
Expand Up @@ -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" {
Expand Down
2 changes: 2 additions & 0 deletions lib/librte_eal/common/include/arch/x86/rte_vect.h
Expand Up @@ -40,6 +40,8 @@
* RTE SSE/AVX related header.
*/

#include <stdint.h>

#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))

#ifdef __SSE__
Expand Down
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/generic/rte_atomic.h
Expand Up @@ -42,6 +42,7 @@
*/

#include <stdint.h>
#include <rte_common.h>

#ifdef __DOXYGEN__

Expand Down
2 changes: 2 additions & 0 deletions lib/librte_eal/common/include/generic/rte_byteorder.h
Expand Up @@ -50,6 +50,8 @@
#include <endian.h>
#endif

#include <rte_common.h>

/*
* Compile-time endianness detection
*/
Expand Down
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/rte_eal.h
Expand Up @@ -44,6 +44,7 @@
#include <sched.h>

#include <rte_per_lcore.h>
#include <rte_config.h>

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 2 additions & 0 deletions lib/librte_eal/common/include/rte_memory.h
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions lib/librte_eal/common/include/rte_time.h
Expand Up @@ -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

/**
Expand Down Expand Up @@ -120,3 +126,5 @@ rte_ns_to_timespec(uint64_t nsec)

return ts;
}

#endif /* _RTE_TIME_H_ */
1 change: 1 addition & 0 deletions lib/librte_eal/common/include/rte_version.h
Expand Up @@ -45,6 +45,7 @@ extern "C" {

#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <rte_common.h>

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/librte_ether/rte_dev_info.h
Expand Up @@ -34,6 +34,8 @@
#ifndef _RTE_DEV_INFO_H_
#define _RTE_DEV_INFO_H_

#include <stdint.h>

/*
* Placeholder for accessing device registers
*/
Expand Down
4 changes: 4 additions & 0 deletions lib/librte_ether/rte_eth_ctrl.h
Expand Up @@ -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
*
Expand Down
1 change: 1 addition & 0 deletions lib/librte_lpm/rte_lpm_neon.h
Expand Up @@ -43,6 +43,7 @@
#include <rte_byteorder.h>
#include <rte_common.h>
#include <rte_vect.h>
#include <rte_lpm.h>

#ifdef __cplusplus
extern "C" {
Expand Down
1 change: 1 addition & 0 deletions lib/librte_lpm/rte_lpm_sse.h
Expand Up @@ -38,6 +38,7 @@
#include <rte_byteorder.h>
#include <rte_common.h>
#include <rte_vect.h>
#include <rte_lpm.h>

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 4 additions & 0 deletions lib/librte_pdump/rte_pdump.h
Expand Up @@ -41,6 +41,10 @@
* packet dump library to provide packet capturing support on dpdk.
*/

#include <stdint.h>
#include <rte_mempool.h>
#include <rte_ring.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
2 changes: 2 additions & 0 deletions lib/librte_reorder/rte_reorder.h
Expand Up @@ -44,6 +44,8 @@
*
*/

#include <rte_mbuf.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
1 change: 1 addition & 0 deletions lib/librte_sched/rte_bitmap.h
Expand Up @@ -64,6 +64,7 @@ extern "C" {
*
***/

#include <string.h>
#include <rte_common.h>
#include <rte_debug.h>
#include <rte_memory.h>
Expand Down
2 changes: 2 additions & 0 deletions lib/librte_sched/rte_reciprocal.h
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions lib/librte_sched/rte_sched_common.h
Expand Up @@ -38,6 +38,7 @@
extern "C" {
#endif

#include <stdint.h>
#include <sys/types.h>

#define __rte_aligned_16 __attribute__((__aligned__(16)))
Expand Down

0 comments on commit f04519d

Please sign in to comment.