|
15 | 15 | * All rights reserved. |
16 | 16 | * Copyright (c) 2015 Research Organization for Information Science |
17 | 17 | * and Technology (RIST). All rights reserved. |
| 18 | + * Copyright (c) 2015 Intel, Inc. All rights reserved. |
18 | 19 | * $COPYRIGHT$ |
19 | 20 | * |
20 | 21 | * Additional copyrights may follow |
|
270 | 271 | typedef OPAL_PTRDIFF_TYPE ptrdiff_t; |
271 | 272 | #endif |
272 | 273 |
|
273 | | -/* |
274 | | - * If we're in C, we may need to bring in the bool type and true/false |
275 | | - * constants. OPAL_NEED_C_BOOL will be true if the compiler either |
276 | | - * needs <stdbool.h> or doesn't define the bool type at all. |
277 | | - */ |
278 | | -#if !(defined(c_plusplus) || defined(__cplusplus)) |
279 | | -# if OPAL_NEED_C_BOOL |
280 | | -# if OPAL_USE_STDBOOL_H |
281 | | - /* If we're using <stdbool.h>, there is an implicit |
282 | | - assumption that the C++ bool is the same size and has |
283 | | - the same alignment. However, configure may have |
284 | | - disabled the MPI C++ bindings, so if "_Bool" exists, |
285 | | - then use that sizeof. */ |
286 | | -# include <stdbool.h> |
287 | | - /* This section exists because AC_SIZEOF(bool) may not be |
288 | | - run in configure if we're not building the MPI C++ |
289 | | - bindings. */ |
290 | | -# undef SIZEOF_BOOL |
291 | | -# if SIZEOF__BOOL > 0 |
292 | | -# define SIZEOF_BOOL SIZEOF__BOOL |
293 | | -# else |
294 | | - /* If all else fails, assume it's 1 */ |
295 | | -# define SIZEOF_BOOL 1 |
296 | | -# endif |
297 | | -# else |
298 | | - /* We need to create a bool type and ensure that it's the |
299 | | - same size / alignment as the C++ bool size / |
300 | | - alignment */ |
301 | | -# define false 0 |
302 | | -# define true 1 |
303 | | -# if SIZEOF_BOOL == SIZEOF_CHAR && OPAL_ALIGNMENT_CXX_BOOL == OPAL_ALIGNMENT_CHAR |
304 | | -typedef unsigned char bool; |
305 | | -# elif SIZEOF_BOOL == SIZEOF_SHORT && OPAL_ALIGNMENT_CXX_BOOL == OPAL_ALIGNMENT_SHORT |
306 | | -typedef short bool; |
307 | | -# elif SIZEOF_BOOL == SIZEOF_INT && OPAL_ALIGNMENT_CXX_BOOL == OPAL_ALIGNMENT_INT |
308 | | -typedef int bool; |
309 | | -# elif SIZEOF_BOOL == SIZEOF_LONG && OPAL_ALIGNMENT_CXX_BOOL == OPAL_ALIGNMENT_LONG |
310 | | -typedef long bool; |
311 | | -# elif defined(SIZEOF_LONG_LONG) && defined(OPAL_ALIGNMENT_LONG) && SIZEOF_BOOL == SIZEOF_LONG && OPAL_ALIGNMENT_CXX_BOOL == OPAL_ALIGNMENT_LONG |
312 | | -typedef long long bool; |
313 | | - /* If we have _Bool, use that */ |
314 | | -# elif SIZEOF__BOOL > 0 |
315 | | -# undef SIZEOF_BOOL |
316 | | -# define bool _Bool |
317 | | -# define SIZEOF_BOOL SIZEOF__BOOL |
318 | | -# else |
319 | | - /* If all else fails, just make bool be an unsigned char |
320 | | - and size of 1 */ |
321 | | -typedef unsigned char bool; |
322 | | -# define SIZEOF_BOOL 1 |
323 | | -# endif |
324 | | -# endif /* OPAL_USE_STDBOOL_H */ |
325 | | -# endif /* OPAL_NEED_C_BOOL */ |
326 | | -#endif |
327 | | - |
328 | 274 | /* |
329 | 275 | * Maximum size of a filename path. |
330 | 276 | */ |
@@ -468,6 +414,9 @@ static inline uint16_t ntohs(uint16_t netvar) { return netvar; } |
468 | 414 |
|
469 | 415 | #define IOVBASE_TYPE void |
470 | 416 |
|
| 417 | +/* ensure the bool type is defined as it is used everywhere */ |
| 418 | +#include <stdbool.h> |
| 419 | + |
471 | 420 | /** |
472 | 421 | * If we generate our own bool type, we need a special way to cast the result |
473 | 422 | * in such a way to keep the compilers silent. |
|
0 commit comments