PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.c-torture / compile / pr44043.c
blob943501b40915b9438995ca8ecda434bf79833deb
1 typedef unsigned char __u8;
2 typedef unsigned short __u16;
3 typedef unsigned int __u32;
4 typedef unsigned long __kernel_size_t;
5 typedef __kernel_size_t size_t;
6 typedef __u8 uint8_t;
7 typedef __u16 __be16;
8 typedef __u32 __be32;
9 struct msghdr {
10 struct iovec * msg_iov;
11 unsigned msg_flags;
13 enum { IPPROTO_ICMP = 1 };
14 struct sk_buff { };
15 static inline __attribute__((always_inline)) struct dst_entry *
16 skb_dst(const struct sk_buff *skb)
19 enum nf_inet_hooks { NF_INET_LOCAL_OUT };
20 struct net_device {
21 unsigned mtu;
23 static inline __attribute__((always_inline)) int
24 NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb,
25 struct net_device *in, struct net_device *out,
26 int (*okfn)(struct sk_buff *), int thresh)
28 int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh);
29 if (ret == 1)
30 ret = okfn(skb);
31 return ret;
33 static inline __attribute__((always_inline)) int
34 NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb,
35 struct net_device *in, struct net_device *out,
36 int (*okfn)(struct sk_buff *))
38 return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, (-((int)(~0U>>1)) - 1));
40 struct dst_entry {
41 struct net_device *dev;
42 int (*output)(struct sk_buff*);
44 static inline __attribute__((always_inline)) int dst_output(struct sk_buff *skb) {
45 return skb_dst(skb)->output(skb);
47 struct iphdr {
48 __u8 protocol;
50 struct inet_sock {
51 __be16 inet_dport;
52 __u8 recverr: 1, hdrincl: 1;
53 struct { } cork;
55 struct icmphdr {
56 __u8 type;
58 struct rtable {
59 union { struct dst_entry dst; } u;
60 __be32 rt_dst;
62 struct sock;
63 struct inet_sock *inet_sk (struct sock *);
64 struct net *sock_net (struct sock *);
65 void *skb_transport_header (struct sk_buff *);
66 static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
67 struct rtable *rt, unsigned int flags)
69 struct inet_sock *inet = inet_sk(sk);
70 struct net *net = sock_net(sk);
71 struct iphdr *iph;
72 struct sk_buff *skb;
73 if (length > rt->u.dst.dev->mtu)
74 ip_local_error(sk, 90, rt->rt_dst, inet->inet_dport, rt->u.dst.dev->mtu);
75 if (flags&0x10)
76 goto out;
77 if (iph->protocol == IPPROTO_ICMP)
78 icmp_out_count(net, ((struct icmphdr *)skb_transport_header(skb))->type);
79 NF_HOOK(2, NF_INET_LOCAL_OUT, skb, ((void *)0), rt->u.dst.dev,
80 dst_output);
81 out:
82 while (0);
84 int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
86 raw_send_hdrinc(sk, msg->msg_iov, len, (void *)0, msg->msg_flags);