Jack
2017-02-21 fb2ee796938f75527571252128a306ba7658871a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*-
 * Copyright (c) 2012-2013 Jan Breuer,
 *
 * All Rights Reserved
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
/**
 * @file   cc.h
 *
 * @brief  compiler detection
 *
 *
 */
 
#ifndef __SCPI_CC_H_
#define __SCPI_CC_H_
 
#ifdef    __cplusplus
extern "C" {
#endif
 
#if defined(__STDC__)
# define C89 1
# if defined(__STDC_VERSION__)
#  define C90 1
#  if (__STDC_VERSION__ >= 199409L)
#   define C94 1
#  endif
#  if (__STDC_VERSION__ >= 199901L)
#   define C99 1
#  endif
# endif
#endif
 
#if POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700
    #define HAVE_STRNDUP 1
    #define HAVE_STRNLEN 1
#endif
 
#if _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || C99
    #define HAVE_SNPRINTF 1
#endif
 
#if _POSIX_C_SOURCE >= 200112L
    #define HAVE_STRNCASECMP 1
#endif
 
#if _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || C99
    #define HAVE_ISNAN 1
#endif
 
#if _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || C99
    #define HAVE_ISFINITE 1
    #define HAVE_SIGNBIT 1
#endif
 
#if XOPEN_SOURCE >= 600 || _BSD_SOURCE || _SVID_SOURCE || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
    #define HAVE_STRTOLL 1
#endif
 
#if _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || C99
    #define HAVE_STRTOF 1
#endif
 
#if _ISOC99_SOURCE || C99
    #define HAVE_STDBOOL 1
#endif
 
/* Compiler specific */
/* RealView/Keil ARM Compiler, e.g. Cortex-M CPUs */
#if defined(__CC_ARM)
#define HAVE_STRNCASECMP        1
#endif
 
/* National Instruments (R) CVI x86/x64 PC platform */
#if defined(_CVI_)
#define HAVE_STRNICMP           1
#endif
 
/* 8bit PIC - PIC16, etc */
#if defined(_MPC_)
#define HAVE_STRNICMP           1
#endif
 
/* PIC24 */
#if defined(__C30__)
#endif
 
/* PIC32mx */
#if defined(__C32__)
#define HAVE_FINITE             1
#endif
 
/* AVR libc */
#if defined(__AVR__)
#include <stdlib.h>
#define HAVE_DTOSTRE            1
#undef HAVE_STRTOF
#define HAVE_STRTOF                0
#endif
 
/* default values */
#ifndef HAVE_STRNLEN
#define HAVE_STRNLEN            0
#endif
 
#ifndef HAVE_STRDUP
#define HAVE_STRDUP             0
#endif
 
#ifndef HAVE_STRNICMP
#define HAVE_STRNICMP           0
#endif
 
#ifndef HAVE_STDBOOL
#define HAVE_STDBOOL            0
#endif
 
#ifndef HAVE_SNPRINTF
#define HAVE_SNPRINTF           0
#endif
 
#ifndef HAVE_STRNCASECMP
#define HAVE_STRNCASECMP        0
#endif
 
#ifndef HAVE_ISNAN
#define HAVE_ISNAN              0
#endif
 
#ifndef HAVE_ISFINITE
#define HAVE_ISFINITE           0
#endif
 
#ifndef HAVE_FINITE
#define HAVE_FINITE             0
#endif
 
#ifndef HAVE_SIGNBIT
#define HAVE_SIGNBIT            0
#endif
 
#ifndef HAVE_STRTOLL
#define HAVE_STRTOLL            0
#endif
 
#ifndef HAVE_STRTOF
#define HAVE_STRTOF             0
#endif
 
#ifdef    __cplusplus
}
#endif
 
#endif /* __SCPI_CC_H_ */