[457] | 1 | /*
|
---|
| 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without modification,
|
---|
| 6 | * are permitted provided that the following conditions are met:
|
---|
| 7 | *
|
---|
| 8 | * 1. Redistributions of source code must retain the above copyright notice,
|
---|
| 9 | * this list of conditions and the following disclaimer.
|
---|
| 10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
|
---|
| 11 | * this list of conditions and the following disclaimer in the documentation
|
---|
| 12 | * and/or other materials provided with the distribution.
|
---|
| 13 | * 3. The name of the author may not be used to endorse or promote products
|
---|
| 14 | * derived from this software without specific prior written permission.
|
---|
| 15 | *
|
---|
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
---|
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
---|
| 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
---|
| 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
---|
| 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
---|
| 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
---|
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
---|
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
---|
| 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
---|
| 25 | * OF SUCH DAMAGE.
|
---|
| 26 | *
|
---|
| 27 | * This file is part of the lwIP TCP/IP stack.
|
---|
| 28 | *
|
---|
| 29 | * Author: Adam Dunkels <adam@sics.se>
|
---|
| 30 | *
|
---|
| 31 | */
|
---|
| 32 | #ifndef LWIP_ARCH_CC_H
|
---|
| 33 | #define LWIP_ARCH_CC_H
|
---|
| 34 |
|
---|
| 35 | #ifdef _MSC_VER
|
---|
| 36 | #pragma warning (disable: 4127) /* conditional expression is constant */
|
---|
| 37 | #pragma warning (disable: 4996) /* 'strncpy' was declared deprecated */
|
---|
| 38 | #pragma warning (disable: 4103) /* structure packing changed by including file */
|
---|
| 39 | #pragma warning (disable: 4820) /* 'x' bytes padding added after data member 'y' */
|
---|
| 40 | #pragma warning (disable: 4711) /* The compiler performed inlining on the given function, although it was not marked for inlining */
|
---|
| 41 | #endif
|
---|
| 42 |
|
---|
| 43 | #ifdef _MSC_VER
|
---|
| 44 | #if _MSC_VER >= 1910
|
---|
| 45 | #include <errno.h> /* use MSVC errno for >= 2017 */
|
---|
| 46 | #else
|
---|
| 47 | #define LWIP_PROVIDE_ERRNO /* provide errno for MSVC pre-2017 */
|
---|
| 48 | #endif
|
---|
| 49 | #else /* _MSC_VER */
|
---|
| 50 | #define LWIP_PROVIDE_ERRNO /* provide errno for non-MSVC */
|
---|
| 51 | #endif /* _MSC_VER */
|
---|
| 52 |
|
---|
| 53 | /* Define platform endianness (might already be defined) */
|
---|
| 54 | #ifndef BYTE_ORDER
|
---|
| 55 | #define BYTE_ORDER LITTLE_ENDIAN
|
---|
| 56 | #endif /* BYTE_ORDER */
|
---|
| 57 |
|
---|
| 58 | typedef int sys_prot_t;
|
---|
| 59 |
|
---|
| 60 | #ifdef _MSC_VER
|
---|
| 61 | /* define _INTPTR for Win32 MSVC stdint.h */
|
---|
| 62 | #define _INTPTR 2
|
---|
| 63 |
|
---|
| 64 | /* Do not use lwIP default definitions for format strings
|
---|
| 65 | * because these do not work with MSVC 2010 compiler (no inttypes.h)
|
---|
| 66 | */
|
---|
| 67 | #define LWIP_NO_INTTYPES_H 1
|
---|
| 68 |
|
---|
| 69 | /* Define (sn)printf formatters for these lwIP types */
|
---|
| 70 | #define X8_F "02x"
|
---|
| 71 | #define U16_F "hu"
|
---|
| 72 | #define U32_F "lu"
|
---|
| 73 | #define S32_F "ld"
|
---|
| 74 | #define X32_F "lx"
|
---|
| 75 |
|
---|
| 76 | #define S16_F "hd"
|
---|
| 77 | #define X16_F "hx"
|
---|
| 78 | #define SZT_F "lu"
|
---|
| 79 | #endif /* _MSC_VER */
|
---|
| 80 |
|
---|
| 81 | /* Compiler hints for packing structures */
|
---|
| 82 | #define PACK_STRUCT_USE_INCLUDES
|
---|
| 83 |
|
---|
| 84 | #define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
|
---|
| 85 | printf("Assertion \"%s\" failed at line %d in %s\n", message, __LINE__, __FILE__); \
|
---|
| 86 | fflush(NULL);handler;} } while(0)
|
---|
| 87 |
|
---|
| 88 | #ifdef _MSC_VER
|
---|
| 89 | /* C runtime functions redefined */
|
---|
| 90 | #if _MSC_VER < 1910
|
---|
| 91 | #define snprintf _snprintf
|
---|
| 92 | #endif
|
---|
| 93 | #define strdup _strdup
|
---|
| 94 | #endif
|
---|
| 95 |
|
---|
| 96 | /* Define an example for LWIP_PLATFORM_DIAG: since this uses varargs and the old
|
---|
| 97 | * C standard lwIP targets does not support this in macros, we have extra brackets
|
---|
| 98 | * around the arguments, which are left out in the following macro definition:
|
---|
| 99 | */
|
---|
| 100 | #if !defined(LWIP_TESTMODE) || !LWIP_TESTMODE
|
---|
| 101 | void lwip_win32_platform_diag(const char *format, ...);
|
---|
| 102 | #define LWIP_PLATFORM_DIAG(x) lwip_win32_platform_diag x
|
---|
| 103 | #endif
|
---|
| 104 |
|
---|
| 105 | #ifndef LWIP_NORAND
|
---|
| 106 | extern unsigned int sys_win_rand(void);
|
---|
| 107 | #define LWIP_RAND() (sys_win_rand())
|
---|
| 108 | #endif
|
---|
| 109 |
|
---|
| 110 | #define PPP_INCLUDE_SETTINGS_HEADER
|
---|
| 111 |
|
---|
| 112 | #endif /* LWIP_ARCH_CC_H */
|
---|