Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cdstd.h
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2023 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 
4 #ifndef CDSTD_H_
5 #define CDSTD_H_
6 
7 // cdstd.h: define macros to select library API version.
8 
9 // This must be included before all library #includes.
10 // Typically this done as part of cddefines.h, only required
11 // independently when cddefines.h is not first include.
12 
13 // We *require* POSIX.1-2008 as a minimum (for strnlen()).
14 // See e.g. Rochkind, Advanced UNIX Programming for more details.
15 
16 // There appears to be a bug in the POSIX implementation in FreeBSD that was
17 // imported into Apple Darwin (at least version 11.4.2) where defining _POSIX_SOURCE
18 // will cause compilation errors as a result of missing type definitions (e.g., u_int)
19 // when including certain system header files. See e.g. this report:
20 // http://lists.freebsd.org/pipermail/freebsd-bugs/2011-April/044049.html
21 #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(_POSIX_SOURCE)
22 #define _POSIX_C_SOURCE 200112L
23 #define _XOPEN_SOURCE 600
24 #endif
25 
26 // Cloudy requires C++11, and we specify this using the -std=c++11 compiler flag.
27 // However, cpp versions prior to 6.1.0 have a bug that causes the __cplusplus flag
28 // to have inconsistent values during compilation, causing compilation errors, e.g.
29 // when including <array>. The following hack works around that...
30 #if __cplusplus < 201103
31 #undef __cplusplus
32 #define __cplusplus 201103
33 #endif
34 
35 #ifdef MPI_GRID_RUN
36 #define MPI_ENABLED
37 #endif
38 
39 // the Intel MPI implementation wants this file included before cstdio...
40 // http://www.saii.ull.es/files/doc_intel/doc/HelpMe_FAQ.htm
41 // so we include it here to make really sure that it is in front of
42 // the system includes that may be done before cddefines.h is included
43 //
44 // we define OMPI_SKIP_MPICXX to silence compiler warnings/errors about a
45 // poorly designed C++ interface in openmpi, see this thread for more details:
46 // https://github.com/open-mpi/ompi/issues/5157
47 #ifdef MPI_ENABLED
48 #define OMPI_SKIP_MPICXX 1
49 #include <mpi.h>
50 #endif
51 
52 #endif // CDSTD_H_