include/net: additional cleanup for extern "C" use

The previous patch left some include directives hidden within the body
of the extern "C" block.  Lift them out to the top of the file where
they're more visible.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2019-08-12 16:40:47 -05:00 committed by Carles Cufí
parent 9346ded0af
commit 754d1274a7
5 changed files with 17 additions and 16 deletions

View file

@ -722,14 +722,14 @@ static inline int net_eth_get_ptp_port(struct net_if *iface)
void net_eth_set_ptp_port(struct net_if *iface, int port);
#endif /* CONFIG_NET_GPTP */
#include <syscalls/ethernet.h>
/**
* @}
*/
#ifdef __cplusplus
}
#endif
/**
* @}
*/
#include <syscalls/ethernet.h>
#endif /* ZEPHYR_INCLUDE_NET_ETHERNET_H_ */

View file

@ -14,6 +14,11 @@
#define ZEPHYR_INCLUDE_NET_NET_CORE_H_
#include <stdbool.h>
#include <string.h>
#include <logging/log.h>
#include <sys/__assert.h>
#include <kernel.h>
#ifdef __cplusplus
extern "C" {
@ -36,30 +41,22 @@ extern "C" {
/** @cond INTERNAL_HIDDEN */
/* Network subsystem logging helpers */
#include <logging/log.h>
#define NET_DBG(fmt, ...) LOG_DBG("(%p): " fmt, k_current_get(), \
##__VA_ARGS__)
#define NET_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)
#define NET_WARN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
#define NET_INFO(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
#include <sys/__assert.h>
#define NET_ASSERT(cond) __ASSERT_NO_MSG(cond)
#define NET_ASSERT_INFO(cond, fmt, ...) __ASSERT(cond, fmt, ##__VA_ARGS__)
/** @endcond */
#include <kernel.h>
struct net_buf;
struct net_pkt;
struct net_context;
struct net_if;
#include <string.h>
/**
* @brief Net Verdict
*/
@ -187,6 +184,7 @@ struct net_stack_info {
#define NET_STACK_DEFINE_EMBEDDED(name, size) char name[size]
#if defined(CONFIG_INIT_STACKS)
/* Legacy case: retain containing extern "C" with C++ */
#include <debug/stack.h>
static inline void net_analyze_stack_get_values(const char *stack,

View file

@ -14,6 +14,7 @@
#include <sys/__assert.h>
#include <net/net_core.h>
#include <net/net_event.h>
#ifdef __cplusplus
extern "C" {
@ -72,8 +73,6 @@ struct net_if;
/** @endcond */
#include <net/net_event.h>
/**
* @typedef net_mgmt_request_handler_t

View file

@ -16,6 +16,7 @@
#include <zephyr/types.h>
#include <net/net_core.h>
#include <net/net_mgmt.h>
#ifdef __cplusplus
extern "C" {
@ -393,8 +394,6 @@ struct net_stats_ppp {
#if defined(CONFIG_NET_STATISTICS_USER_API)
/* Management part definitions */
#include <net/net_mgmt.h>
#define _NET_STATS_LAYER NET_MGMT_LAYER_L3
#define _NET_STATS_CODE 0x101
#define _NET_STATS_BASE (NET_MGMT_LAYER(_NET_STATS_LAYER) | \

View file

@ -697,6 +697,11 @@ struct addrinfo {
struct addrinfo *ai_next;
};
/* Legacy case: retain containing extern "C" with C++
*
* This header requires aliases defined within this file, and can't
* easily be moved to the top.
*/
#include <net/socket_offload.h>
static inline int inet_pton(sa_family_t family, const char *src, void *dst)