sock: ignore -Wtypedef-redefinition for LLVM where needed

net/sock/async/types.h included by net/sock.h needs to re-typedef the
the sock types to prevent cyclic includes.
This commit is contained in:
Martine S. Lenders 2020-01-06 15:31:41 +01:00
parent 82180a8bb6
commit 3896145c31
No known key found for this signature in database
GPG Key ID: CCD317364F63286F
5 changed files with 55 additions and 0 deletions

View File

@ -15,6 +15,12 @@
extern "C" { extern "C" {
#endif #endif
/* This header needs to re-typedef the sock types to prevent cyclic includes */
#if defined (__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wtypedef-redefinition"
#endif
#if defined(SOCK_HAS_ASYNC) || defined(DOXYGEN) #if defined(SOCK_HAS_ASYNC) || defined(DOXYGEN)
/** /**
* @brief Flag types to signify asynchronous sock events * @brief Flag types to signify asynchronous sock events
@ -133,11 +139,16 @@ typedef void (*sock_udp_cb_t)(sock_udp_t *sock, sock_async_flags_t type);
#ifdef MODULE_SOCK_DTLS #ifdef MODULE_SOCK_DTLS
#include "sock_dtls_types.h" #include "sock_dtls_types.h"
#endif /* MODULE_SOCK_DTLS */ #endif /* MODULE_SOCK_DTLS */
#ifdef SOCK_HAS_ASYNC_CTX #ifdef SOCK_HAS_ASYNC_CTX
#include "sock_async_ctx.h" #include "sock_async_ctx.h"
#endif #endif
#endif /* defined(SOCK_HAS_ASYNC) || defined(DOXYGEN) */ #endif /* defined(SOCK_HAS_ASYNC) || defined(DOXYGEN) */
#if defined (__clang__)
# pragma clang diagnostic pop
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -461,6 +461,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
/* net/sock/async/types.h included by net/sock.h needs to re-typedef the
* `sock_dtls_t` to prevent cyclic includes */
#if defined (__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wtypedef-redefinition"
#endif
#include "net/sock.h" #include "net/sock.h"
#include "net/sock/udp.h" #include "net/sock/udp.h"
#include "net/credman.h" #include "net/credman.h"
@ -500,6 +507,10 @@ enum {
*/ */
typedef struct sock_dtls sock_dtls_t; typedef struct sock_dtls sock_dtls_t;
#if defined (__clang__)
# pragma clang diagnostic pop
#endif
/** /**
* @brief Information about a created session. * @brief Information about a created session.
*/ */

View File

@ -273,6 +273,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
/* net/sock/async/types.h included by net/sock.h needs to re-typedef the
* `sock_ip_t` to prevent cyclic includes */
#if defined (__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wtypedef-redefinition"
#endif
#include "net/sock.h" #include "net/sock.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -287,6 +294,10 @@ extern "C" {
*/ */
typedef struct sock_ip sock_ip_t; typedef struct sock_ip sock_ip_t;
#if defined (__clang__)
# pragma clang diagnostic pop
#endif
/** /**
* @brief Creates a new raw IPv4/IPv6 sock object * @brief Creates a new raw IPv4/IPv6 sock object
* *

View File

@ -303,6 +303,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
/* net/sock/async/types.h included by net/sock.h needs to re-typedef the
* `sock_tcp_t` and `sock_tcp_queue_t` to prevent cyclic includes */
#if defined (__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wtypedef-redefinition"
#endif
#include "net/sock.h" #include "net/sock.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -327,6 +334,10 @@ typedef struct sock_tcp sock_tcp_t;
*/ */
typedef struct sock_tcp_queue sock_tcp_queue_t; typedef struct sock_tcp_queue sock_tcp_queue_t;
#if defined (__clang__)
# pragma clang diagnostic pop
#endif
/** /**
* @brief Establishes a new TCP sock connection * @brief Establishes a new TCP sock connection
* *

View File

@ -273,6 +273,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
/* net/sock/async/types.h included by net/sock.h needs to re-typedef the
* `sock_ip_t` to prevent cyclic includes */
#if defined (__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wtypedef-redefinition"
#endif
#include "net/sock.h" #include "net/sock.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -289,6 +296,10 @@ typedef struct _sock_tl_ep sock_udp_ep_t; /**< An end point for a UDP sock obj
*/ */
typedef struct sock_udp sock_udp_t; typedef struct sock_udp sock_udp_t;
#if defined (__clang__)
# pragma clang diagnostic pop
#endif
/** /**
* @brief Creates a new UDP sock object * @brief Creates a new UDP sock object
* *