Disabled a clang warning

release/4.3a0
Richard Roberts 2013-11-19 14:04:42 +00:00
parent abf5df5f7e
commit 138e092fec
1 changed files with 17 additions and 5 deletions

View File

@ -39,6 +39,20 @@
#include <omp.h> #include <omp.h>
#endif #endif
#ifdef __clang__
# define CLANG_DIAGNOSTIC_PUSH_IGNORE(diag) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"" diag "\"")
#else
# define CLANG_DIAGNOSTIC_PUSH_IGNORE(diag)
#endif
#ifdef __clang__
# define CLANG_DIAGNOSTIC_POP() _Pragma("clang diagnostic pop")
#else
# define CLANG_DIAGNOSTIC_POP()
#endif
namespace gtsam { namespace gtsam {
/// Integer nonlinear key type /// Integer nonlinear key type
@ -236,6 +250,7 @@ namespace gtsam {
/// An object whose scope defines a block where TBB and OpenMP parallelism are mixed. In such a /// An object whose scope defines a block where TBB and OpenMP parallelism are mixed. In such a
/// block, we use default threads for TBB, and p/2 threads for OpenMP. If GTSAM is not compiled to /// block, we use default threads for TBB, and p/2 threads for OpenMP. If GTSAM is not compiled to
/// use both TBB and OpenMP, this has no effect. /// use both TBB and OpenMP, this has no effect.
CLANG_DIAGNOSTIC_PUSH_IGNORE("-Wunused-private-field") // Clang complains that previousOpenMPThreads is unused in the #else case below
class TbbOpenMPMixedScope class TbbOpenMPMixedScope
{ {
int previousOpenMPThreads; int previousOpenMPThreads;
@ -253,14 +268,11 @@ namespace gtsam {
omp_set_num_threads(previousOpenMPThreads); omp_set_num_threads(previousOpenMPThreads);
} }
#else #else
TbbOpenMPMixedScope() : previousOpenMPThreads(-1) TbbOpenMPMixedScope() : previousOpenMPThreads(-1) {}
{
(void) previousOpenMPThreads; // Avoid clang unused variable warning
}
~TbbOpenMPMixedScope() {} ~TbbOpenMPMixedScope() {}
#endif #endif
}; };
CLANG_DIAGNOSTIC_POP()
} }