casacore
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: aips2-request@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 //# $Id$
27 
28 #ifndef CASA_AIPSDEF_H
29 #define CASA_AIPSDEF_H
30 
31 #include <casacore/casa/aipstype.h> //# needed for Bool
32 
33 //# Define the Casacore global macros
34 
35 //# Defined the "aips_name2" macro which is used to join two tokens.
36 
37 #if defined(__STDC__) || defined(__ANSI_CPP__) || defined(__hpux)
38 #define aips_name2(a,b) a##b
39 #else
40 #define aips_name2(a,b) ab
41 #endif
42 
43 namespace casacore { //# NAMESPACE CASACORE - BEGIN
44 
45 // If AIPS_DEBUG is not defined, then the symbol expands to (0) which in an
46 // if should be removed by the dead code eliminator of any optimizer; thus
47 // using this in your code should have no performance penalty in the normal
48 // case. If compiled with AIPS_DEBUG, then aips_debug is (defined to )
49 // a global boolean variable (so it can be turned on and off in a debugger)
50 // which is initialized to True.
51 
52 extern Bool aips_debug_on;
53 
54 } //# NAMESPACE CASACORE - END
55 
56 #if !defined(AIPS_DEBUG)
57 #define aips_debug (0)
58 #else
59 // The reason that we just don't make this a variable here is so that
60 // we can link against libraries compiled with or without AIPS_DEBUG
61 // without having any missing symbols.
62 #define aips_debug aips_debug_on
63 #endif
64 
65 // HP/UX
66 #if defined(__hpux__)
67 #define AIPS_HPUX
68 #endif
69 
70 // The restrict keyword is supported by some compilers only.
71 #if !defined(AIPS_KAICC) && !defined(AIPS_INTELCC)
72 #if !defined(restrict)
73 #define restrict
74 #endif
75 #endif
76 
77 // Define the macros to stringify a preprocessor variable.
78 #define CASACORE_STRINGIFY(x) CASACORE_STRINGIFY_HELPER(x)
79 #define CASACORE_STRINGIFY_HELPER(x) #x
80 
81 // A fallthrough attribute to avoid compiler warnings,
82 // available only from C++17 onwards
83 #if __cplusplus >= 201703L
84 #define CASACORE_FALLTHROUGH [[fallthrough]]
85 #elif defined(__GNUC__) && __GNUC__ >= 7
86 #define CASACORE_FALLTHROUGH [[gnu::fallthrough]]
87 #elif defined(__clang__)
88 #define CASACORE_FALLTHROUGH [[clang::fallthrough]]
89 #else
90 #define CASACORE_FALLTHROUGH
91 #endif
92 
93 #endif
this file contains all the compiler specific defines
Definition: mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
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 ...