1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s
28e8fb3be5bd78f0564444eca02b404566a5f3b5dAndy Gibbs// expected-no-diagnostics
3c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Narofftypedef long unsigned int __darwin_size_t;
4c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Narofftypedef long __darwin_ssize_t;
5c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Narofftypedef __darwin_size_t size_t;
6c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Narofftypedef __darwin_ssize_t ssize_t;
7c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff
8c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroffstruct cmsghdr {};
9c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff
10c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff#if 0
11c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve NaroffThis code below comes from the following system headers:
121eb4433ac451dc16f4133a88af2d002ac26c58efMike Stumpsys/socket.h:#define CMSG_SPACE(l) (__DARWIN_ALIGN(sizeof(struct
13c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroffcmsghdr)) + __DARWIN_ALIGN(l))
14c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff
151eb4433ac451dc16f4133a88af2d002ac26c58efMike Stumpi386/_param.h:#define __DARWIN_ALIGN(p) ((__darwin_size_t)((char *)(p)
16c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff+ __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
17c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff#endif
18c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff
19c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroffssize_t sendFileDescriptor(int fd, void *data, size_t nbytes, int sendfd) {
20c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff  union {
21c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff    char control[(((__darwin_size_t)((char *)(sizeof(struct cmsghdr)) + (sizeof(__darwin_size_t) - 1)) &~ (sizeof(__darwin_size_t) - 1)) + ((__darwin_size_t)((char *)(sizeof(int)) + (sizeof(__darwin_size_t) - 1)) &~ (sizeof(__darwin_size_t) - 1)))];
22c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff  } control_un;
23d1969d803cfcc65f1c334df4cc89c7fdd33ee4c9Mike Stump  return 0;
24c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff}
25c793808539b2ed6ec3324ff9ba0f57aa54e027caSteve Naroff
26