OSDN Git Service

Factor BSD non-standard type definitions into common header.
[mingw/mingw-org-wsl.git] / mingwrt / include / sys / bsdtypes.h
1 /*
2  * bsdtypes.h
3  *
4  * Defines non-standard data types, typically used in BSD source code,
5  * and adopted by the Windows sockets implementation; users are advised
6  * to avoid using these data types, and use standard types instead.
7  *
8  * $Id$
9  *
10  * Abstracted from MinGW.org's WinSock implementation
11  * Copyright (C) 2017, MinGW.org Project
12  *
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining a
15  * copy of this software and associated documentation files (the "Software"),
16  * to deal in the Software without restriction, including without limitation
17  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18  * and/or sell copies of the Software, and to permit persons to whom the
19  * Software is furnished to do so, subject to the following conditions:
20  *
21  * The above copyright notice and this permission notice (including the next
22  * paragraph) shall be included in all copies or substantial portions of the
23  * Software.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
31  * DEALINGS IN THE SOFTWARE.
32  *
33  */
34 #ifndef _SYS_BSDTYPES_H
35 #pragma  GCC system_header
36 #define _SYS_BSDTYPES_H
37
38 /* This additional guard macro is required, to co-operate with newlib's
39  * <sys/types.h>, which also defines the data types defined herein.
40  */
41 #ifndef _BSDTYPES_DEFINED
42
43 /* All MinGW.org headers are required to include <_mingw.h>
44  */
45 #include <_mingw.h>
46
47 #if ! (defined _BSD_SOURCE || defined _WINSOCK_H)
48 /* Users are STRONGLY recommended to avoid using the non-standard BSD
49  * data types defined herein, unless compiling code which proclaims its
50  * _BSD_SOURCE heritage, or which uses the Windows Sockets API, (which
51  * has ill-advisedly adopted them).
52  */
53 #warning "Use of non-standard BSD type definitions is ill-advised."
54 #endif
55
56 /* Use "unsigned foo" instead of these "u_foo" shorthand aliases.
57  */
58 typedef unsigned char   u_char;
59 typedef unsigned short  u_short;
60 typedef unsigned int    u_int;
61 typedef unsigned long   u_long;
62
63 #define _BSDTYPES_DEFINED
64 #endif  /* !_BSDTYPES_DEFINED */
65 #endif  /* _SYS_BSDTYPES_H: $RCSfile$: end of file */