Mesh Oriented datABase
(version 5.5.1)
An array-based unstructured mesh library
Compiler.hpp
Go to the documentation of this file.
1
/** \file Compiler.hpp
2
* \author Jason Kraftcheck
3
* \date 2010-12-16
4
*
5
* Provide pre-processor macros for compiler-specific features. All
6
* defined macros should expand to nothing if not supported by the
7
* compiler.
8
*/
9
10
#ifndef moab_COMPILER_HPP
11
#define moab_COMPILER_HPP
12
13
#ifdef IS_BUILDING_MB
14
15
/** Private Compiler-Specifc Pre-Processor Macros */
16
17
/**\def __restrict__
18
*\brief Provide functionality similar to C99 \c restrict keyword
19
*
20
* Tell the compiler that a pointer is not aliased. This means that
21
* programmer guarantees that no other pointer will be used to reference
22
* memory that is referenced through the designated pointer unless it
23
* is obivous to the compiler in the relevant function. A typical use
24
* for this is to specify that two pointer arguments to a function will
25
* never be used to reference overlapping memory. For example:
26
*\code
27
* void* memcpy(void* __restrict__ dest, const void* __restrict__ src, size_t len);
28
*\endcode
29
* Says that the memory locations indicated by the \c dest and \c src pointers
30
* will never be used to reference overlapping memory, including offsets up to
31
* \c len.
32
*
33
* Notifying the compiler about lack of pointer aliasing allows it to make
34
* better optimizations. However, the behavior is undefined (and probably
35
* broken in platform-specific ways) if designated pointers are aliased.
36
*/
37
#ifdef __cplusplus
38
#if !defined __GNUC__ || __GNUC__ < 4 || __GNUC_MINOR__ < 5
39
#define __restrict__
40
#endif
41
#endif
42
43
44
#endif
45
46
/** Public Compiler-Specifc Pre-Processor Macros */
47
48
/**\def PRINT_FORMAT(start)
49
*\brief Give a hint to the compiler the function is like \c printf
50
*
51
* Tell the compiler that the function involves a printf-style format
52
* string and varargs list. This gives the compiler the opportunity
53
* to warn if the argument types do not match the format string.
54
* This macro should be inluded after the complete function declaration,
55
* but before the closing semi-colon.
56
*
57
*\param START The position of the format string in the argument list, where
58
* the first argument is 1.
59
*\NOTE This macro is designed to be used with member functions of C++ classes,
60
* and therefore explicitly accounts for the implicit \c this pointer
61
* in the argument list. It will not work correctly with static or
62
* non-member functions.
63
*\NOTE This macro assumes that the arguments referenced in the format string
64
* begin immediately after the format string itself.
65
*/
66
#ifdef __GNUC__
67
#define MB_PRINTF( START ) __attribute__( ( format( printf, ( START ) + 1, ( START ) + 2 ) ) )
68
#else
69
#define MB_PRINTF( START )
70
#endif
71
72
/**\def MB_DLL_EXPORT
73
*\brief Declare a function or class to be visible in shared library.
74
*/
75
/**\def MB_DLL_HIDDEN
76
*\brief Declare a function or class to be internal to a shared library.
77
*/
78
#if defined _MSC_VER || defined __CYGWIN__ || defined __MINGW32__ || defined __MINGW64__ || defined _WIN32
79
#if !defined IS_BUILDING_MB || !defined MB_EXPORTS
80
#define MB_DLL_EXPORT __dllspec( dllexport )
81
#elif !defined MB_WIN_DLL
82
#define MB_DLL_EXPORT __dllspec( dllimport )
83
#else
84
#define MB_DLL_EXPORT
85
#endif
86
#define MB_DLL_HIDDEN
87
#elif defined __GNUC__ && __GNUC__ > 3
88
#define MB_DLL_EXPORT __attribute__( ( visibility( "default"
) ) )
89
#define MB_DLL_HIDDEN __attribute__( ( visibility( "hidden"
) ) )
90
#else
91
#define MB_DLL_EXPORT
92
#define MB_DLL_HIDDEN
93
#endif
94
95
/**\def MB_DEPRECATED
96
*\brief Mark function or API as deprecated
97
*/
98
#if defined( __GNUC__ ) && ( 1000 * __GNUC__ + __GNUC_MINOR__ ) > 3000
99
#define MB_DEPRECATED __attribute__( ( __deprecated__ ) )
100
#else
101
#define MB_DEPRECATED
102
#endif
103
104
#endif
// moab_COMPILER_HPP
src
moab
Compiler.hpp
Generated on Tue Oct 29 2024 02:05:38 for Mesh Oriented datABase by
1.9.1.