P99
Main Page
Related Pages
Modules
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
c
d
e
f
i
l
m
n
r
s
t
w
Functions
c
e
f
i
n
r
Variables
Typedefs
Related Functions
Files
File List
Globals
All
0
1
2
3
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
i
j
l
m
n
p
r
s
t
u
v
w
Variables
Typedefs
_
b
c
d
e
f
i
l
m
o
p
r
s
t
u
v
Enumerations
Enumerator
Macros
0
1
2
3
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Examples
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
p99
p99_if.h
Go to the documentation of this file.
1
/* This may look like nonsense, but it really is -*- mode: C; coding: utf-8 -*- */
2
/* */
3
/* Except for parts copied from previous work and as explicitly stated below, */
4
/* the authors and copyright holders for this work are as follows: */
5
/* (C) copyright 2010-2012 Jens Gustedt, INRIA, France */
6
/* (C) copyright 2012 William Morris */
7
/* */
8
/* This file is free software; it is part of the P99 project. */
9
/* */
10
/* Licensed under the Apache License, Version 2.0 (the "License"); */
11
/* you may not use this file except in compliance with the License. */
12
/* You may obtain a copy of the License at */
13
/* */
14
/* http://www.apache.org/licenses/LICENSE-2.0 */
15
/* */
16
/* Unless required by applicable law or agreed to in writing, software */
17
/* distributed under the License is distributed on an "AS IS" BASIS, */
18
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
19
/* See the License for the specific language governing permissions and */
20
/* limitations under the License. */
21
/* */
22
#ifndef P99_IF_H_
23
# define P99_IF_H_
24
30
#include "
p99_logical.h
"
31
66
#define P00_IGNORE(...)
67
#define P00_IDENT(...) __VA_ARGS__
68
#define P00_SKIP_
69
#define P00_CLAUSE1(...) __VA_ARGS__ P00_IGNORE
70
#define P00_CLAUSE2(...) P00_IDENT
71
72
#define P00__IF_CLAUSE(A,B,C,...) C
73
#define P00_IF_CLAUSE(EXP) P00__IF_CLAUSE(EXP, P00_CLAUSE1, P00_CLAUSE2, ~)
74
#define P00_IF_NOT_CLAUSE(EXP) P00__IF_CLAUSE(EXP, P00_CLAUSE2, P00_CLAUSE1, ~)
75
92
#define P99_IF_EQ(A, B) P00_IF_CLAUSE(P99_PASTE4(P00_IS_,A,_EQ_,B)())
93
99
#define P99_IF_NE(A, B) P00_IF_NOT_CLAUSE(P99_PASTE4(P00_IS_,A,_EQ_,B)())
100
101
#define P99_IF_GE_0(A) P00_IF_CLAUSE(P99_PASTE4(P00_IS_,A,_GE_,0)())
102
#define P99_IF_LT_0(A) P00_IF_NOT_CLAUSE(P99_PASTE4(P00_IS_,A,_GE_,0)())
103
108
#define P99_IF_GE(A, B) P99_IF_EQ_1(P99_IS_GE(A, B))
109
114
#define P99_IF_LE(A, B) P99_IF_EQ_1(P99_IS_LE(A, B))
115
120
#define P99_IF_LT(A, B) P99_IF_EQ_1(P99_IS_LT(A, B))
121
126
#define P99_IF_GT(A, B) P99_IF_EQ_1(P99_IS_GT(A, B))
127
131
#define P99_IF_EQ_0(N) P99_IF_EQ(0, N)
132
136
#define P99_IF_EQ_1(N) P99_IF_EQ(1, N)
137
141
#define P99_IF_EQ_2(N) P99_IF_EQ(2, N)
142
146
#define P99_IF_EQ_3(N) P99_IF_EQ(3, N)
147
151
#define P99_IF_EQ_4(N) P99_IF_EQ(4, N)
152
153
#define P99_IF_EMPTY(...) P99_IF_EQ_1(P99_IS_EMPTY(__VA_ARGS__))
154
167
#define P99_IF_ELSE(...) P99_IF_EQ_0(P99_IS_EQ_0(__VA_ARGS__))
168
169
#define P99_IF_void(...) P99_IF_EQ_1(P99_IS_EQ_void(__VA_ARGS__))
170
171
#define P99_IF_VOID(...) P99_IF_EQ_1(P99_IS_VOID(__VA_ARGS__))
172
173
174
#define P00_PRAGMA_(STR) _Pragma(STR)
175
#define P00_PRAGMA(...) P00_PRAGMA_(#__VA_ARGS__)
176
184
#define P99_PRAGMA(...) P99_IF_EMPTY(__VA_ARGS__)()(P00_PRAGMA(__VA_ARGS__))
185
190
# undef p99_has_builtin
191
# undef p99_has_feature
192
# undef p99_has_extension
193
# undef p99_has_attribute
194
195
# define p99_has_builtin(X) (P99_IF_EQ_1(__has_builtin(X))(1)(0) || P99_IF_EQ_1(p00_has_builtin_ ## X)(1)(0)) // Compatibility with non-clang compilers.
196
# define p99_has_feature(X) (P99_IF_EQ_1(__has_feature(X))(1)(0) || P99_IF_EQ_1(p00_has_feature_ ## X)(1)(0)) // Compatibility with non-clang compilers.
197
# define p99_has_extension(X) (P99_IF_EQ_1(__has_extension(X))(1)(0) || P99_IF_EQ_1(p00_has_extension_ ## X)(1)(0)) // Compatibility with non-clang compilers.
198
# define p99_has_attribute(X) (P99_IF_EQ_1(__has_attribute(X))(1)(0) || P99_IF_EQ_1(p00_has_attribute_ ## X)(1)(0)) // Compatibility with non-clang compilers.
199
200
201
#endif
/* !P99_IF_H_ */
p99_logical.h
macros to handle Boolean conditions at compile time.
Generated by
1.8.17