From d8f44ba5598040b5f8158bbe039351496bb716f1 Mon Sep 17 00:00:00 2001 From: Sergey Yagovtsev Date: Wed, 31 Aug 2016 21:51:00 +0300 Subject: [PATCH] Gcc compile fix --- CMakeLists.txt | 4 ++-- include/profiler/profiler.h | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86c1add..3367ed5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,8 +27,8 @@ include_directories( ) if(UNIX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -Wno-reorder -pedantic -O3" ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -Wno-reorder -pedantic -O3" ) else() add_definitions( -D_CRT_SECURE_NO_WARNINGS diff --git a/include/profiler/profiler.h b/include/profiler/profiler.h index 0d94583..85ca848 100644 --- a/include/profiler/profiler.h +++ b/include/profiler/profiler.h @@ -99,7 +99,11 @@ Name of the block automatically created with function name. \ingroup profiler */ -#define EASY_FUNCTION(...) EASY_BLOCK(__func__ , ## __VA_ARGS__) +#define EASY_FUNCTION(...)\ + static const ::profiler::StaticBlockDescriptor EASY_UNIQUE_DESC(__LINE__)(__func__, __FILE__, __LINE__,\ + ::profiler::BLOCK_TYPE_BLOCK , ## __VA_ARGS__);\ + ::profiler::Block EASY_UNIQUE_BLOCK(__LINE__)(::profiler::BLOCK_TYPE_BLOCK, EASY_UNIQUE_DESC(__LINE__).id(), "");\ + ::profiler::beginBlock(EASY_UNIQUE_BLOCK(__LINE__)); // this is to avoid compiler warning about unused variable /** Macro of completion of last nearest open block.