casacore
Loading...
Searching...
No Matches
aipsdef.h
Go to the documentation of this file.
1// # aipsdef.h: Global initialization for special Casacore macros
2// # Copyright (C) 2000,2001,2002
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef CASA_AIPSDEF_H
27#define CASA_AIPSDEF_H
28
29#include <casacore/casa/aipstype.h> //# needed for Bool
30
31// # Define the Casacore global macros
32
33// # Defined the "aips_name2" macro which is used to join two tokens.
34
35#if defined(__STDC__) || defined(__ANSI_CPP__) || defined(__hpux)
36#define aips_name2(a, b) a##b
37#else
38#define aips_name2(a, b) a /**/ b
39#endif
40
41namespace casacore { // # NAMESPACE CASACORE - BEGIN
42
43// If AIPS_DEBUG is not defined, then the symbol expands to (0) which in an
44// if should be removed by the dead code eliminator of any optimizer; thus
45// using this in your code should have no performance penalty in the normal
46// case. If compiled with AIPS_DEBUG, then aips_debug is (defined to )
47// a global boolean variable (so it can be turned on and off in a debugger)
48// which is initialized to True.
49
50extern Bool aips_debug_on;
51
52} // namespace casacore
53
54#if !defined(AIPS_DEBUG)
55#define aips_debug (0)
56#else
57// The reason that we just don't make this a variable here is so that
58// we can link against libraries compiled with or without AIPS_DEBUG
59// without having any missing symbols.
60#define aips_debug aips_debug_on
61#endif
62
63// HP/UX
64#if defined(__hpux__)
65#define AIPS_HPUX
66#endif
67
68// The restrict keyword is supported by some compilers only.
69#if !defined(AIPS_KAICC) && !defined(AIPS_INTELCC)
70#if !defined(restrict)
71#define restrict
72#endif
73#endif
74
75// Define the macros to stringify a preprocessor variable.
76#define CASACORE_STRINGIFY(x) CASACORE_STRINGIFY_HELPER(x)
77#define CASACORE_STRINGIFY_HELPER(x) #x
78
79// A fallthrough attribute to avoid compiler warnings,
80// available only from C++17 onwards
81#if __cplusplus >= 201703L
82#define CASACORE_FALLTHROUGH [[fallthrough]]
83#elif defined(__GNUC__) && __GNUC__ >= 7
84#define CASACORE_FALLTHROUGH [[gnu::fallthrough]]
85#elif defined(__clang__)
86#define CASACORE_FALLTHROUGH [[clang::fallthrough]]
87#else
88#define CASACORE_FALLTHROUGH
89#endif
90
91#endif
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Bool aips_debug_on
If AIPS_DEBUG is not defined, then the symbol expands to (0) which in an if should be removed by the ...