Skip to content

Commit

Permalink
convert to C11's _Static_assert, and pull in sys/cdefs.h for
Browse files Browse the repository at this point in the history
compatibility w/ older non-C11 compilers...

passed make tinerdbox..

Suggested by:	imp
  • Loading branch information
jmgurney committed Aug 2, 2015
1 parent 6f6b650 commit 9b30185
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions sys/net/pfkeyv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
#ifndef _NET_PFKEYV2_H_
#define _NET_PFKEYV2_H_

#ifndef _KERNEL
#define CTASSERT(x) struct __thisisjustnothing;
#endif
#include <sys/cdefs.h>

/*
This file defines structures and symbols for the PF_KEY Version 2
Expand Down Expand Up @@ -231,7 +229,7 @@ struct sadb_x_policy {
u_int32_t sadb_x_policy_id;
u_int32_t sadb_x_policy_reserved2;
};
CTASSERT(sizeof(struct sadb_x_policy) == 16);
_Static_assert(sizeof(struct sadb_x_policy) == 16, "struct size mismatch");

/*
* When policy_type == IPSEC, it is followed by some of
Expand Down Expand Up @@ -267,7 +265,7 @@ struct sadb_x_nat_t_type {
u_int8_t sadb_x_nat_t_type_type;
u_int8_t sadb_x_nat_t_type_reserved[3];
};
CTASSERT(sizeof(struct sadb_x_nat_t_type) == 8);
_Static_assert(sizeof(struct sadb_x_nat_t_type) == 8, "struct size mismatch");

/* NAT-Traversal source or destination port. */
struct sadb_x_nat_t_port {
Expand All @@ -276,7 +274,7 @@ struct sadb_x_nat_t_port {
u_int16_t sadb_x_nat_t_port_port;
u_int16_t sadb_x_nat_t_port_reserved;
};
CTASSERT(sizeof(struct sadb_x_nat_t_port) == 8);
_Static_assert(sizeof(struct sadb_x_nat_t_port) == 8, "struct size mismatch");

/* ESP fragmentation size. */
struct sadb_x_nat_t_frag {
Expand All @@ -285,7 +283,7 @@ struct sadb_x_nat_t_frag {
u_int16_t sadb_x_nat_t_frag_fraglen;
u_int16_t sadb_x_nat_t_frag_reserved;
};
CTASSERT(sizeof(struct sadb_x_nat_t_frag) == 8);
_Static_assert(sizeof(struct sadb_x_nat_t_frag) == 8, "struct size mismatch");


#define SADB_EXT_RESERVED 0
Expand Down

0 comments on commit 9b30185

Please sign in to comment.