From d855608e6ec2cc42656b9245c3420725d7afa993 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 26 Aug 2016 15:08:50 +0300 Subject: [PATCH] instrumentation: fix build on Linux - enable C++11 - fix macro --- cmake/OpenCVCompilerOptions.cmake | 5 +++++ modules/core/include/opencv2/core/private.hpp | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index cce57a9364..15e4db1125 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -233,6 +233,11 @@ if(CMAKE_COMPILER_IS_GNUCXX) set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} --coverage") endif() + if(ENABLE_INSTRUMENTATION) + set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} --std=c++11") + set(WITH_VTK OFF) # There are issues with VTK 6.0 + endif() + set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} -DNDEBUG") set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG") endif() diff --git a/modules/core/include/opencv2/core/private.hpp b/modules/core/include/opencv2/core/private.hpp index 44e1a44bc1..1a876b03f2 100644 --- a/modules/core/include/opencv2/core/private.hpp +++ b/modules/core/include/opencv2/core/private.hpp @@ -502,12 +502,12 @@ CV_EXPORTS InstrNode* getCurrentNode(); auto status = ((FUN)(__VA_ARGS__));\ if(ERROR_COND){\ ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\ - CV_INSTRUMENT_MARK_META(IMPL, ##FUN - BadExit);\ + CV_INSTRUMENT_MARK_META(IMPL, #FUN " - BadExit");\ }\ return status;\ }catch(...){\ ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\ - CV_INSTRUMENT_MARK_META(IMPL, ##FUN - BadExit);\ + CV_INSTRUMENT_MARK_META(IMPL, #FUN " - BadExit");\ throw;\ }\ }else{\ @@ -523,7 +523,7 @@ CV_EXPORTS InstrNode* getCurrentNode(); (FUN)(__VA_ARGS__);\ }catch(...){\ ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\ - CV_INSTRUMENT_MARK_META(IMPL, ##FUN - BadExit);\ + CV_INSTRUMENT_MARK_META(IMPL, #FUN "- BadExit");\ throw;\ }\ }else{\ @@ -531,7 +531,7 @@ CV_EXPORTS InstrNode* getCurrentNode(); }\ }()) // Instrumentation information marker -#define CV_INSTRUMENT_MARK_META(IMPL, NAME, ...) {::cv::instr::IntrumentationRegion __instr_mark__(#NAME, __FILE__, __LINE__, ::cv::instr::TYPE_MARKER, IMPL);} +#define CV_INSTRUMENT_MARK_META(IMPL, NAME, ...) {::cv::instr::IntrumentationRegion __instr_mark__(NAME, __FILE__, __LINE__, ::cv::instr::TYPE_MARKER, IMPL);} ///// General instrumentation // General OpenCV region instrumentation macro