diff --git a/easy_profiler_core/event_trace_win.cpp b/easy_profiler_core/event_trace_win.cpp index cf238e6..f12aaaa 100644 --- a/easy_profiler_core/event_trace_win.cpp +++ b/easy_profiler_core/event_trace_win.cpp @@ -111,7 +111,12 @@ #define MANAGER ProfileManager::instance() extern const ::profiler::color_t EASY_COLOR_INTERNAL_EVENT; + +#ifdef _MSC_VER ::std::atomic_uint64_t TRACING_END_TIME = ATOMIC_VAR_INIT(~0ULL); +#else +::std::atomic TRACING_END_TIME = ATOMIC_VAR_INIT(~0ULL); +#endif namespace profiler { diff --git a/easy_profiler_core/hashed_cstr.h b/easy_profiler_core/hashed_cstr.h index 6a214d5..9035338 100644 --- a/easy_profiler_core/hashed_cstr.h +++ b/easy_profiler_core/hashed_cstr.h @@ -39,7 +39,8 @@ ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// -#ifdef _WIN32 +#if defined(_MSC_VER)// && _MSC_VER >= 1800 +# define EASY_PROFILER_HASHED_CSTR_DEFINED namespace profiler { diff --git a/easy_profiler_core/include/easy/easy_compiler_support.h b/easy_profiler_core/include/easy/easy_compiler_support.h index 5463f6d..7e16279 100644 --- a/easy_profiler_core/include/easy/easy_compiler_support.h +++ b/easy_profiler_core/include/easy/easy_compiler_support.h @@ -46,7 +46,7 @@ //#define EASY_CODE_WRAP(Code) Code #ifdef _WIN32 -# define __func__ __FUNCTION__ +// Visual Studio and MinGW # ifdef _BUILD_PROFILER # define PROFILER_API __declspec(dllexport) # else @@ -60,6 +60,8 @@ ////////////////////////////////////////////////////////////////////////// // Visual Studio +# define __func__ __FUNCTION__ + # if _MSC_VER <= 1800 // There is no support for C++11 thread_local keyword prior to Visual Studio 2015. Use __declspec(thread) instead. // There is also no support for C++11 magic statics feature :( So it becomes slightly harder to initialize static vars - additional "if" for each profiler block. diff --git a/easy_profiler_core/profile_manager.h b/easy_profiler_core/profile_manager.h index f64ed16..0c6d437 100644 --- a/easy_profiler_core/profile_manager.h +++ b/easy_profiler_core/profile_manager.h @@ -100,7 +100,7 @@ namespace profiler { # define EASY_MALLOC(MEMSIZE, A) malloc(MEMSIZE) # define EASY_FREE(MEMPTR) free(MEMPTR) #else -# if defined(_WIN32) +# if defined(_MSC_VER) # define EASY_ALIGNED(TYPE, VAR, A) __declspec(align(A)) TYPE VAR # define EASY_MALLOC(MEMSIZE, A) _aligned_malloc(MEMSIZE, A) # define EASY_FREE(MEMPTR) _aligned_free(MEMPTR) @@ -353,7 +353,7 @@ class ProfileManager typedef std::map map_of_threads_stacks; typedef std::vector block_descriptors_t; -#ifdef _WIN32 +#ifdef EASY_PROFILER_HASHED_CSTR_DEFINED typedef std::unordered_map descriptors_map_t; #else typedef std::unordered_map descriptors_map_t; diff --git a/easy_profiler_core/reader.cpp b/easy_profiler_core/reader.cpp index 5da363c..98b19dd 100644 --- a/easy_profiler_core/reader.cpp +++ b/easy_profiler_core/reader.cpp @@ -91,7 +91,7 @@ const uint64_t TIME_FACTOR = 1000000000ULL; #ifdef EASY_USE_FLOATING_POINT_CONVERSION // Suppress warnings about double to uint64 conversion -# ifdef _WIN32 +# ifdef _MSC_VER # pragma warning(disable:4244) # elif defined(__GNUC__) # pragma GCC diagnostic push @@ -181,7 +181,7 @@ namespace profiler { ////////////////////////////////////////////////////////////////////////// -#ifdef _WIN32 +#ifdef EASY_PROFILER_HASHED_CSTR_DEFINED typedef ::std::unordered_map<::profiler::block_id_t, ::profiler::BlockStatistics*, ::profiler::passthrough_hash> StatsMap; @@ -946,7 +946,7 @@ extern "C" { #undef EASY_CONVERT_TO_NANO #ifdef EASY_USE_FLOATING_POINT_CONVERSION -# ifdef _WIN32 +# ifdef _MSC_VER # pragma warning(default:4244) # elif defined(__GNUC__) # pragma GCC diagnostic pop