BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
deprecated.hpp
1 // Copyright (C) 2011-2012 by the Fiber Authors
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20 
21 #ifndef bempp_deprecated_hpp
22 #define bempp_deprecated_hpp
23 
24 #include "common.hpp"
25 
32 #if defined(SWIGPYTHON) // we want to wrap deprecated features
33  // without generating warnings
34 # define BEMPP_DEPRECATED
35 #else
36 # if defined(__GNUC__)
37 # define BEMPP_DEPRECATED __attribute__ ((deprecated))
38 # elif defined(_MSC_VER)
39 # define BEMPP_DEPRECATED __declspec(deprecated)
40 # else
41 # define BEMPP_DEPRECATED
42 # endif
43 #endif
44 
45 // Macros for temporarily disabling deprecation warnings, by Jonathan Wakely
46 // (http://gcc.gnu.org/ml/gcc-help/2011-01/msg00135.html); modified.
47 // Should be called like
48 // BEMPP_GCC_DIAG_OFF(deprecated)
49 // BEMPP_GCC_DIAG_ON(deprecated)
50 #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
51 #define BEMPP_GCC_DIAG_STR(s) #s
52 #define BEMPP_GCC_DIAG_JOINSTR(x,y) BEMPP_GCC_DIAG_STR(x ## y)
53 # define BEMPP_GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
54 # define BEMPP_GCC_DIAG_PRAGMA(x) BEMPP_GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
55 # if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
56 # define BEMPP_GCC_DIAG_OFF(x) BEMPP_GCC_DIAG_PRAGMA(push) \
57  BEMPP_GCC_DIAG_PRAGMA(ignored BEMPP_GCC_DIAG_JOINSTR(-W,x))
58 # define BEMPP_GCC_DIAG_ON(x) BEMPP_GCC_DIAG_PRAGMA(pop)
59 # else
60 # define BEMPP_GCC_DIAG_OFF(x) BEMPP_GCC_DIAG_PRAGMA(ignored BEMPP_GCC_DIAG_JOINSTR(-W,x))
61 // This doesn't seem to work for GCC 4.4, so we just give up and don't restore
62 // the warning level.
63 // # define BEMPP_GCC_DIAG_ON(x) BEMPP_GCC_DIAG_PRAGMA(warning BEMPP_GCC_DIAG_JOINSTR(-W,x))
64 # define BEMPP_GCC_DIAG_ON(x)
65 # endif
66 #else
67 # define BEMPP_GCC_DIAG_OFF(x)
68 # define BEMPP_GCC_DIAG_ON(x)
69 #endif
70 
71 #endif // bempp_deprecated_hpp