Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
feelmacros.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2005-01-24
7 
8  Copyright (C) 2009 Université de Grenoble 1
9  Copyright (C) 2005,2006 EPFL
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 3.0 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
30 #ifndef FEELMACROS_HPP
31 #define FEELMACROS_HPP 1
32 
48 #ifdef __GNUC__
49 #define FEELPP_GNUC_AT_LEAST(x,y) ((__GNUC__>=x && __GNUC_MINOR__>=y) || __GNUC__>x)
50 #else
51 #define FEELPP_GNUC_AT_LEAST(x,y) 0
52 #endif
53 
54 #ifdef __clang__
55 #define FEELPP_CLANG_AT_LEAST(x,y) ((__clang_major__>=x && __clang_minor__>=y) || __clang_major__>x)
56 #else
57 #define FEELPP_CLANG_AT_LEAST(x,y) 0
58 #endif
59 
64 #define FEELPP_CONSTRUCTOR_BEGIN(A) DVLOG(3) << "Constructor of " << A << " begins\n";
65 #define FEELPP_CONSTRUCTOR(A) FEELPP_CONSTRUCTOR_BEGIN(A)
66 #define CONSTRUCTOR(A) FEELPP_CONSTRUCTOR_BEGIN(A)
67 
72 #define FEELPP_CONSTRUCTOR_END(A) DVLOG(3) << "Constructor of " << A << " ends\n";
73 
78 #define FEELPP_DESTRUCTOR_BEGIN(A) DVLOG(3) << "Destructor of " << A << " begins\n";
79 #define FEELPP_DESTRUCTOR(A) FEELPP_DESTRUCTOR_END(A)
80 #define DESTRUCTOR(A) FEELPP_DESTRUCTOR_BEGIN(A)
81 
86 #define FEELPP_DESTRUCTOR_END(A) DVLOG(3) << "Destructor of " << A << " ends\n";
87 
88 
94 #define INLINE inline
95 
147 #define FEELPP_RESTRICT __restrict__
148 
149 
150 
151 
152 
211 #if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 > 2)
212 #define FEELPP_EXPORT __attribute__ ((visibility("default")))
213 
214 #define FEELPP_NO_EXPORT __attribute__ ((visibility("hidden")))
215 #else
216 #define FEELPP_EXPORT
217 #define FEELPP_NO_EXPORT
218 #endif
219 
311 #ifdef __GNUC__
312 #define FEELPP_PACKED __attribute__((__packed__))
313 #else
314 #define FEELPP_PACKED
315 #endif
316 
349 #if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2)
350 # define FEELPP_DEPRECATED __attribute__ ((deprecated))
351 #else
352 # define FEELPP_DEPRECATED
353 #endif
354 
386 #if __GNUC__ - 0 >= 3
387 # define FEELPP_ISLIKELY( x ) __builtin_expect(!!(x),1)
388 # define FEELPP_ISUNLIKELY( x ) __builtin_expect(!!(x),0)
389 #else
390 # define FEELPP_ISLIKELY( x ) ( x )
391 # define FEELPP_ISUNLIKELY( x ) ( x )
392 #endif
393 
455 #if __GNUC__ - 0 >= 3
456 # define FEELPP_PREFETCH( x, rw, locality ) __builtin_prefetch( (x), rw, locality )
457 #else
458 # define FEELPP_PREFETCH( x, rw, locality )
459 #endif // __GNUC__
460 
501 #if __GNUC__ - 0 >= 3
502 # define FEELPP_IS_CONSTANT( n ) __builtin_constant_p( n )
503 #else
504 # define FEELPP_IS_CONSTANT( n )
505 #endif // __GNUC__
506 
507 #define FEELPP_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
508 
509 #ifdef NDEBUG
510 # ifndef FEELPP_NO_DEBUG
511 # define FEELPP_NO_DEBUG
512 # endif
513 #endif
514 
515 // FEELPP_ALWAYS_INLINE_ATTRIB should be use in the declaration of function
516 // which should be inlined even in debug mode.
517 #if FEELPP_GNUC_AT_LEAST(4,0)
518 #define FEELPP_ALWAYS_INLINE_ATTRIB __attribute__((always_inline))
519 #else
520 #define FEELPP_ALWAYS_INLINE_ATTRIB
521 #endif
522 
523 // FEELPP_FORCE_INLINE means "inline as much as possible"
524 #if (defined _MSC_VER) || (defined __intel_compiler)
525 #define FEELPP_STRONG_INLINE __forceinline
526 #else
527 #define FEELPP_STRONG_INLINE inline
528 #endif
529 
530 #if (defined __GNUC__)
531 #define FEELPP_DONT_INLINE __attribute__((noinline))
532 #elif (defined _MSC_VER)
533 #define FEELPP_DONT_INLINE __declspec(noinline)
534 #else
535 #define FEELPP_DONT_INLINE
536 #endif
537 
538 #endif /* FEELMACROS_HPP */

Generated on Sun Dec 22 2013 13:11:00 for Feel++ by doxygen 1.8.5